Correcting Common Async/Await Mistakes in .NET 8
summary
Claims that the C# compiler lowers async methods into generated state‑machine structs with a hidden try/catch (so unawaited tasks can silently swallow exceptions) and that each async adds about 80 bytes in .NET 8. Shows debugging with SharpLab, a refactor of a Hacker News app that replaces serial requests with IAsyncEnumerable + parallel Task.WhenAny, uses safe fire and forget extension and ValueTask, and reports smaller app size, fewer swallowed exceptions, and measurable runtime speed-ups.
AI-written summary · about
chapters (11)
- 0:00Async/await in .NET 8
- 1:10How async/await works
- 10:15Awaiting tasks is critical
- 13:46Refactoring Hacker News app
- 20:08Fixing async void in constructors
- 22:12UI thread await efficiency
- 30:45Avoid Task.Delay and ConfigureAwaitOptions
- 35:01IAsyncEnumerable for streaming
- 41:45Optimizing with ValueTask
- 46:42Async/await best practices
- 54:55Resources and closing
related talks
01h 00mCorrecting 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
55mAsync internals in .NET
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
43m.NET: Asyn http client - anatomy and traps
