Correcting Common Async/Await Mistakes in .NET
summary
Shows that the C# compiler turns async methods into IAsyncStateMachine classes (about 100 bytes overhead) and that the generated MoveNext wrapped in try/catch can hide exceptions when tasks are not awaited. Live refactors a Xamarin Hacker News app: replace .Wait/.Result with await or GetAwaiter().GetResult to avoid deadlocks and AggregateException, use ConfigureAwait(false) to skip context switches, return Task instead of async/await to skip the state machine, use ValueTask for hot paths and a safe fire-and-forget extension; demos and NuGet packages prove the fixes reduce allocations, expose exceptions, and speed execution.
AI-written summary · about
chapters (5)
- 0:00Start
- 0:10Correcting Common Async/Await Mistakes in .NET
- 2:15Multi Threading
- 14:07Quick Review
- 14:24Await Every Task
related talks
01h 05mCorrecting Common Async/Await Mistakes in .NET 10
01h 01mCorrecting Common Async/Await Mistakes in .NET 9
49mCorrecting Common Mistakes in Asynchronous .NET Code
01h 00mCorrecting Common Async/Await Mistakes in .NET 8
56mCorrecting Common Async/Await Mistakes in .NET 8
57mBack to Basics: Efficient Async and Await
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
59mAsynchronous Programming From The Ground Up
