I've notice a lot of the code does some serious thread blocking, like for instance:
IAsyncOperationWithProgress<HttpResponseMessage, HttpProgress> responseOperation = client.PostAsync(uri, requestContent);
TaskAwaiter<HttpResponseMessage> responseAwaiter = responseOperation.GetAwaiter();
while (!responseAwaiter.IsCompleted)
{
}
using (HttpResponseMessage response = responseOperation.GetResults())
{
///...
}
Is there a reason await isn't just used instead? This loop would saturate the thread, and I think there's a potential of deadlock here, which would also explain why so often my requests are hanging and never return.
All the code above could be rewritten to:
using (HttpResponseMessage response = await client.PostAsync(uri, requestContent))
{
///...
}
I can make a PR to clean this all up, but the pattern is used throughout and I'm wondering if there was a reason for it?
@WilliamsJason @hpsin
I've notice a lot of the code does some serious thread blocking, like for instance:
Is there a reason await isn't just used instead? This loop would saturate the thread, and I think there's a potential of deadlock here, which would also explain why so often my requests are hanging and never return.
All the code above could be rewritten to:
I can make a PR to clean this all up, but the pattern is used throughout and I'm wondering if there was a reason for it?
@WilliamsJason @hpsin