title: async method in foreach
body: <p>I'm writing Windows Forms Application and i have a problem with blocking UI while loading data from FTP server.</p>
  
  <p>I have a list of servers from which i'm getting info. So, when i click button 'Get from all' i get info from each of them.</p>
  
  <pre><code>private void GetInfoToolStripMenuItem_Click(object sender, EventArgs e)
  {
      foreach (DataGridViewRow row in infoDataGridView.Rows)
          this.GetInfoAsync(row);
  }
  </code></pre>
  
  <p>I run new task when getting info from server to prevent UI blocking. The method <strong>GetInfo</strong> is async:</p>
  
  <pre><code>private async void GetInfoAsync(DataGridViewRow row)
  {
      Server server = (Server)row.Cells[0].Value;
      row.Cells[1].Value = Resources.GettingIcon;
  
      await Task.Run(() =&gt;
      {
          server.Data = dataGetter.GetData(server);
      });
  
      row.Cells[1].Value = Resources.FinishedIcon;
  }
  </code></pre>
  
  <p>The main question is: why foreach starts new iteration before <strong>GetInfoAsync</strong> finished? I'm using <strong>await</strong> keyword in this method, so execution should not finish before data getting finished.</p>