I am trying to understand why the following Task.Run
and GetAwaiter().GetResult()
would be used instead of await ... <result>
(var success, var response) = Task.Run(() => HTTPHelper.SendRequest<SomeJsonResponse>( ... )).GetAwaiter().GetResult();
Does the code above throw, as this article shows, an Exception
and not an AggregateException
? If so, I believe that is why this structure was chosen.
Is it possible to use async ... await
in this situation and have the same result? (I assume not, if the single exception requirement is only possible with the code above.)