title: Async/Await and Task<T> does not return data
body: <p>When I do this it doesn't return  <code>Task&lt;TokenModel&gt;</code> I mean this line is freezing <code>tokenModel = await response.Content.ReadAsAsync&lt;TokenModel&gt;();</code></p>
  
  <pre><code>Foo()
  {
     var r = IsLoginOk();
  }
  public async Task&lt;TokenModel&gt; IsLoginOk()
  {
  
    var handler = new HttpClientHandler();
    handler.UseDefaultCredentials = true;
    handler.PreAuthenticate = true;
    handler.ClientCertificateOptions = ClientCertificateOption.Automatic;
  
    client = new HttpClient(handler);
    client.BaseAddress = new Uri(Properties.Settings.Default.WebApiUrl);
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));                
  
    var apiAccountLogin = apiManager.ApiAccountLogin(Properties.Settings.Default.WebApiPassword, Properties.Settings.Default.WebApiUsername);
  
    var response = await  client.PostAsJsonAsync(apiAccountLogin.Url, apiAccountLogin.Container);
  
    response.EnsureSuccessStatusCode();  
    tokenModel = await response.Content.ReadAsAsync&lt;TokenModel&gt;();
  
    return tokenModel;
  }
  </code></pre>
  
  <p>But if I use <code>void</code> then it is working fine</p>
  
  <pre><code>Foo()
  {
       IsLoginOk();
  }
  public async void IsLoginOk()
  {
  
    var handler = new HttpClientHandler();
    handler.UseDefaultCredentials = true;
    handler.PreAuthenticate = true;
    handler.ClientCertificateOptions = ClientCertificateOption.Automatic;
  
    client = new HttpClient(handler);
    client.BaseAddress = new Uri(Properties.Settings.Default.WebApiUrl);
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));                
  
    var apiAccountLogin = apiManager.ApiAccountLogin(Properties.Settings.Default.WebApiPassword, Properties.Settings.Default.WebApiUsername);
  
    var response = await  client.PostAsJsonAsync(apiAccountLogin.Url, apiAccountLogin.Container);
  
    response.EnsureSuccessStatusCode();  
    tokenModel = await response.Content.ReadAsAsync&lt;TokenModel&gt;();   
  }
  </code></pre>
  
  <p>As I see my code is like Microsift example code <a href="http://msdn.microsoft.com/en-us/library/hh191443.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/hh191443.aspx</a> .</p>
  
  <p>Is this kind of  some <strong>Deadlock</strong>?</p>
  
  <p>I need to return <strong>tokenModel</strong>. How I can do this?
  Thanks!</p>