title: Parallel.Invoke does not wait for async methods to complete
body: <p>I have an application that pulls a fair amount of data from different sources. A local database, a networked database, and a web query. Any of these can take a few seconds to complete. So, first I decided to run these in parallel:</p>
  <pre><code>Parallel.Invoke(
     () =&gt; dataX = loadX(),
     () =&gt; dataY = loadY(),
     () =&gt; dataZ = loadZ()
  );
  </code></pre>
  <p>As expected, all three execute in parallel, but execution on the whole block doesn't come back until the last one is done.</p>
  <p>Next, I decided to add a spinner or &quot;busy indicator&quot; to the application. I don't want to block the UI thread or the spinner won't spin. So these need to be ran in <code>async</code> mode. But if I run all three in an <code>async</code> mode, then they in affect happen &quot;synchronously&quot;, just not in the same thread as the UI. I still want them to run in parallel.</p>
  <pre><code>spinner.IsBusy = true;
  
  Parallel.Invoke(
       async () =&gt; dataX = await Task.Run(() =&gt; { return loadX(); }),
       async () =&gt; dataY = await Task.Run(() =&gt; { return loadY(); }),
       async () =&gt; dataZ = await Task.Run(() =&gt; { return loadZ(); })
  );
  
  spinner.isBusy = false;
  </code></pre>
  <p>Now, the <code>Parallel.Invoke</code> does not wait for the methods to finish and the spinner is instantly off. Worse, dataX/Y/Z are null and exceptions occur later.</p>
  <p>What's the proper way here? Should I use a <code>BackgroundWorker</code> instead? I was hoping to make use of the .NET 4.5 features.</p>