title: Task.wait not working as I imagined
body: <p>I am trying to download a file, wait for the file to finish downloading, and then read the file afterwards. I have the following methods to do this:</p>
  
  <pre><code>private async Task startDownload(string link, string savePath)
  {      
          WebClient client = new WebClient();
          client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
          client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
          await client.DownloadFileTaskAsync(new Uri(link), savePath);              
  }
  
  private void checkUpdateButton_Click(object sender, EventArgs e)
  {           
      Task task = Task.Factory.StartNew(() =&gt; startDownload(versionLink, versionSaveTo));
      task.Wait();
  
      if (task.IsCompleted)
      {
          checkVersion();
      }
  }
  </code></pre>
  
  <p>The <code>checkVersion()</code> method reads the file that was downloaded. This is throwing an <code>IOException</code> saying that the file is in use by something else and cannot be read. I thought that having <code>task.Wait</code> would prevent the rest of the method from executing until the task was finished?</p>