Correcting Common Async/Await Mistakes in .NET 8
summary
Explains concrete fixes for async/await on .NET 8 and C#12: shows the compiler turning async methods into classes (adds ~100 bytes each), demonstrates hidden try/catch in the generated state machine, and shows how non-awaited Task.Run hides exceptions. Uses ConfigureAwait(false) to avoid returning to the UI thread, replaces serial calls with IAsyncEnumerable + Task.WhenAny to stream 50 Hacker News stories, prefers ValueTask for hot paths, recommends cancellation tokens and a SafeFireAndForget helper (used by ~1M downloads).
AI-written summary · about
chapters (9)
- 0:00Async/await in .NET 8
- 13:32Fixing async/await mistakes
- 22:55Fire-and-forget safely
- 26:44Cancellation tokens
- 31:02Never use Task.Wait
- 37:03Streaming with IAsyncEnumerable
- 47:01Optimizing with ValueTask
- 53:42Async/await best practices
- 59:27Resources & closing
related talks
56mCorrecting Common Async/Await Mistakes in .NET 8
01h 01mCorrecting Common Async/Await Mistakes in .NET 9
01h 05mCorrecting Common Async/Await Mistakes in .NET 10
01h 00mCorrecting Common Async/Await Mistakes in .NET
49mCorrecting Common Mistakes in Asynchronous .NET Code
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
01h 00mAvoiding common pitfalls with async/await
01h 15mBest Practices for Using async and await
