title: Issue with async Task<T> in xamarin forms
body: <p>I'm trying to use the Azure media services with REST api, in a xamarin shared project on visual studio 2013. This is the code i use to get the access token.</p>
  
  <pre><code>public HttpFactory()
  {
      string token = GetToken(serviceURI).Result;
      //some more methods also async tasks
  }
  
  private async Task&lt;string&gt; GetToken(Uri serviceUri)
  {
      HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(serviceURI);
      request.Accept = "application/json";
      request.Method = "GET";
      request.Headers["Host"] = "media.windows.net";
      request.Headers["x-ms-version"] = "2.9";
      request.Headers["Authorization"] = "Bearer " + token;
      var response = (HttpWebResponse) await request.GetResponseAsync();
  
      if (response.StatusCode == HttpStatusCode.MovedPermanently)
      {
          serviceURI = new Uri(response.Headers["Location"]);
          HttpWebRequest req = ( HttpWebRequest)WebRequest.Create(serviceURI);
          var res = (HttpWebResponse)await req.GetResponseAsync();
  
          using (Stream responseStream = res.GetResponseStream())
          {
              using (StreamReader reader = new StreamReader(responseStream))
              {
                  string str = reader.ReadToEnd();
                  // var test = JsonConvert.DeserializeObject(str);
                  JToken jtoken = JsonConvert.DeserializeObject&lt;JToken&gt;(str);
                   return jtoken["access_token"].Value&lt;string&gt;();
  
              }
          }
      }
      return "";
  }
  </code></pre>
  
  <p>But when the compiler reaches -</p>
  
  <pre><code>var response = (HttpWebResponse) await request.GetResponseAsync();
  </code></pre>
  
  <p>it skips the rest of the code, and i never get the response. I know the code is working - because it works just fine without the task, in a async void method.</p>
  
  <p>Anyone knows how to fix this, or am i doing something wrong? I also tried this in vs2015 but its the same.</p>