title: Asynchronous functions in Xamarin C# Android - Application stuck with thread
body: <p>I'm trying to figure out a bug in my C# Xamarin Android code. Simple thing this application is ought to do - connect to the REST API, download the contents as a string for further analysis. At first my mistake was not including async tasks and using voids instead, but when I changed them the code seems to be stuck at point of retrieval of data.</p>
  
  <pre><code>String content;
  private void OnClick1(object sender, EventArgs e)
  {
      output.Text = "";
      GetJSONTextFromWeb("https://ameobea.me/osutrack/api/get_changes.php?user=XXXXXX&amp;mode=0", "XXXXXX", "0");
      while (content==null)
      {
          DoNothing();
      }
      output.Text = content;
  }
  private async Task GetJSONTextFromWeb(String address, String user, String modeID)
     {
        URL url = new URL(address);
        URLConnection conn = url.OpenConnection();
        //conn.AddRequestProperty("user", user);   those lines are
        //conn.AddRequestProperty("mode", modeID); removed for investigation.
        //conn.Connect(); //this one caused the same issue.
        content = (String)conn.Content; //Here the code seems to freeze without any warning.
     }
  private void DoNothing()
  {
     //literally. Made to await for the result.
  }
  </code></pre>
  
  <p>Anyone knows the possible reason?</p>