Thread Exhaustion Due to GetAwaiter().GetResult() in C#
Thread Exhaustion Due to GetAwaiter().GetResult() in C# Recently we’ve seen an abundance of Async only API’s in c# and common libraries like httpclient. In most cases, this encorages best practice async/await development especially on the server side, however not all is good. In some unique situations, we need to call these async method in a synchronous manner. The most common way to do this is using GetAwaiter.GetResult() Task<string> pingTask = new HttpClient().GetStringAsync("https://google.com"); var webpage = pingTask.GetAwaiter().GetResult(); The GetAwaiter().GetResult() call blocks the calling thread and this can cause thread starvation. ...