Note that there are some explanatory texts on larger screens.

plurals
  1. POPostAsync method of HttpClient throws an Aggregate exception after 2-3 timeout requests
    primarykey
    data
    text
    <p>I am making a webrequest using HttpClient and it involves "Timeout" feature, everything works fine apart from the timeout feature</p> <p>which throws an "Aggregate Exception" when a request is hit 2-3 times(like click on Sign In button and request gets timed out).</p> <p>i ve tried "Catching" the exception but it doesnt work.</p> <p>Code used :</p> <pre><code> try { HttpClient httpClient = new HttpClient(); //explicit timeout for testing TimeSpan requestTimeout = new TimeSpan(1000); httpClient.Timeout = requestTimeout; HttpContent httpContent = new StringContent(postJSON); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = null; response = await httpClient.PostAsync(url, httpContent); if (response != null) { response.EnsureSuccessStatusCode(); netResults = await response.Content.ReadAsStringAsync(); Logger.Log("NetworkRequest:ResponseStream:Json result:" + netResults); } if (this.convertedType != null) { MemoryStream assetReader = GetMemoryStreamFromString(netResults); assetReader.Position = 0; object value = fromJSON(assetReader, this.convertedType); networkReqSuccessWithObjectCallback(this, value); } else { //Return netResult as string. networkReqSuccessWithStringCallback(this, netResults); } } catch (TaskCanceledException) { ErrorException ee = null; ee = new ErrorException("RequestTimeOut"); NotifyNetworkDelegates(ee); } catch (WebException we) { // failure ErrorException ee = null; ee = ErrorException.fromJSON(we.Message); NotifyNetworkDelegates(ee); } catch (Exception e) { Do something. } </code></pre> <p>Any idea on what is going wrong here.(using C#+XAML+Win8)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload