Call stacks in async methods are fundamentally different compared to synchronous execution. This leads to pitfalls where seemingly reasonable refactoring can make a method “disappear” from the Stack Trace. Let’s see why and how. …
Tag: async/await
I wrote a series of articles describing the async/await State Machine produced by the C# compiler when it encounters an asynchronous method. The discussion starts with a high-level conceptual overview and gradually moves towards the intriguing technical details and performance optimizations. …
Let’s examine the concrete implementation of the async/await State Machine along with all the intriguing optimizations performed by the compiler. …
A conceptual implementation of the async/await State Machine …
The async/await State Machine can be easily understood with a comprehensive workflow diagram that models the program flow and the state transitions. Such a higher-level representation is a mandatory step before diving into the implementation details. Let’s see how that looks! …