title: For some reason my async method doesn't work in specific cases
body: <p>So... a month ago I started developing for the Universal Windows Platform on Visual Studio, and I made a small app to keep up with the prices of Bitcoin, Ethereum and Litecoin (each one with its chart and everything).</p>
  
  <p>My problem comes in a function I called "GetHisto", that gets the historic values for last hour/day/week/month/year, and it always works as expected changing between this time-ranges by clicking in one of the 5 buttons, except if I jump from month/year to last hour, when the app just stays loading forever.</p>
  
  <p>This is my code for GetHisto:</p>
  
  <pre><code>    async internal static Task GetHisto(string crypto, string time, int limit) {
          String URL = "https://min-api.cryptocompare.com/data/histo" + time + "?e=CCCAGG&amp;fsym="
              + crypto + "&amp;tsym=" + coin + "&amp;limit=" + limit;
  
          if (limit == 0)
              URL = "https://min-api.cryptocompare.com/data/histoday?e=CCCAGG&amp;fsym=" + crypto + "&amp;tsym=" + coin + "&amp;allData=true";
  
          Uri requestUri = new Uri(URL);
          HttpClient httpClient = new HttpClient();
          string response = "";
  
  
          try {
              //Send the GET request
              response = await httpClient.GetStringAsync(requestUri);
              var data = JToken.Parse(response);
  
              //var jsonStatham = await GetJSONAsync(requestUri);
              //JToken data = jsonStatham.Result;
  
              //simplified the code as this part was not important
  </code></pre>
  
  <p>The two lines comments on the code are from a method I saw on <a href="http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html" rel="nofollow noreferrer">http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html</a> , but although with that method the app never crashes anymore, the UI becomes none responsive while it gets the data, which is a big drawback. (Specially since I recently added a small loading animation, which shows with this code, but not with the method from the commented lines.</p>
  
  <p>Is there any way I'm not aware of to use those two commented lines, while still leaving the UI responsive?</p>
  
  <p>EDIT: tried putting an await on the catch clause, but still looks like it doesn't fire. When i'm debugging, and the app is going to get stuck, it gets to this first line:</p>
  
  <pre><code>httpResponse = await httpClient.GetAsync(uri);
  </code></pre>
  
  <p>and it stays in that line forever without going to the next one to check the status code:</p>
  
  <pre><code>httpResponse.EnsureSuccessStatusCode();
  </code></pre>
  
  <p>EDIT2: Okey, I think I know whats wrong! And it's not anything from this code, because I created a new project where i made the same request in order automatically and everything went okey. So I "step back", and thought that if the problem was when I changed from month/year to hour, but not from day to hour, it could be that the time-span of those are too different, and making test with the TelerikUI library I'm using for the charts, it looks like the problem is indeed how I handle the updating process of the chart. This is how I handle it right now:</p>
  
  <pre><code>             case "hour":
                  BTC_DateTimeAxis.LabelFormat = "{0:HH:mm}";
                  BTC_DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Minute;
                  BTC_DateTimeAxis.MajorStep = 10;
                  BTC_DateTimeAxis.Minimum = DateTime.Now.AddHours(-1);
                  timeSpan = "hour";
                  limit = 60;
                  break;
  
              case "day":
                  BTC_DateTimeAxis.LabelFormat = "{0:HH:mm}";
                  BTC_DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Hour;
                  BTC_DateTimeAxis.Minimum = DateTime.Now.AddDays(-1);
                  BTC_DateTimeAxis.MajorStep = 6;
                  timeSpan = "day";
                  limit = 1500;
                  break;
               .....
  </code></pre>
  
  <p>So, whenever I have the chart on week/month/year mode, and I jump directly to hour, seems like changing the MajorStepUnit and MajorStep values of the axis breaks the chart and the whole app. 
  (and I guess the debugger staying indefinitely on httpClient.GetAsync(uri); is just because of being various threads working but not because that line is the one causing the bug.)</p>