title: Why does await not wait?
body: <p>This is my actual code:</p>
  
  <pre><code>    async Task getData()
      {
          Thread.Sleep(5000);
          Console.WriteLine("Step 1");
  
          using (HttpClient api = new HttpClient()) 
              await api.GetAsync("http://google.com/").ContinueWith(
                  (getTask) =&gt;
                      Console.WriteLine(getTask.Result.StatusCode);
              );
  
          Console.WriteLine("Step 2");
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          Task&lt;Task&gt; task = new Task&lt;Task&gt;(getData);
          task.Start();
          task.Wait();
          Console.WriteLine("Step 3");
      }
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>Step 1
  Step 3
  OK
  Step 2
  </code></pre>
  
  <p>Why does <code>Step 3</code> not come after <code>Step 2</code>?</p>
  
  <p>How do I get it to work in sequence, ie to return to the caller of <code>getData</code> only until everything in <code>getData</code> is done?</p>