2

In our iOS App, we currently do not prevent the user from making infinite AsyncCalls on the HttpClient.

Everytime a button is pressed, the HttpClient fires a request and after presssing the button an extreme amount of times at High Speed (say 40 times in 5 seconds) the Threads start throwing canceled exceptions. Every class that has to use a HttpClient roughly implements it like this:

var handler = new NativeMessageHandler { AllowAutoRedirect = false, UseCookies = false };
using (var httpClient = new HttpClient(handler)
{ 
    BaseAddress = new Uri(this.serviceSettings.BaseUrl),
    Timeout = TimeSpan.FromSeconds(this.serviceSettings.Timeout)
})
{
    return await httpClient.GetAsync(url);
}

Either our usage (and implementation) of the HttpClient is correct and we should implement a simple GUI fix, or our understanding of the HttpClient is wrong and our implementation is wrong.

MichielDeRouter
  • 426
  • 4
  • 21

0 Answers0