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. ...

March 20, 2025 · 4 min · 819 words · Mayuresh Waykole

Events

Events In this post, we will explore what events are, how they are used and the advantages. Throughout the post we will build our way up to a complete event driven program. We will use python do this, since python has no inherent way to handle events we need to build everything from scratch. Events Events in the simplest terms are notifications. Software written such that it largely relies on events for communication is said to be Event Driven ...

May 1, 2019 · 3 min · 591 words · Mayuresh Waykole