C# Language Internals
summary
Live demo of compiler internals showing the actual code paths: inspects Roslyn source and generated IL, attaches the compiler in the debugger, and opens WinDbg/SOS to run dumpheap and dumpil. Shows events implemented with a generated add/remove loop using interlocked compare-exchange, explains synthetic synchronous entrypoints for async main, and walks the async lowering that builds a struct state machine which does state machine boxing when an await yields, hoists evaluation-stack temporaries to fields, and uses ExceptionDispatchInfo for await-in-finally.
AI-written summary · about
chapters (20)
- 0:00Start
- 2:20Initializers
- 2:35Interpolated Strings
- 2:59Events
- 5:58Multicast Delegate
- 8:04Interlock Compare Exchange
- 8:58Source Code
- 9:08Roslin Source Code
- 11:28Async Tasks
- 12:10Async Main
- 21:39Get Well-Known Member
- 22:56Display Classes
- 23:53Async Method
- 26:54Async State Machine
- 41:30Stacks Building
- 45:16Hidden Hot Potato
- 46:25Exception Dispatch Infer
- 46:45Runtime Exception Services
- 48:50Transparent Identifier
- 50:42Polymorphic Inline Cache
related talks
51mThe Future of C#
56mLowering in C#: What's really going on in your code?
01h 01mInternals of Exceptions
50mWhat’s really going on under the hood? The hidden life of method calls.
01h 00mUnveiling .NET Secrets with the World's Smallest C# Program
50mThe Future of C#
59mCompilers can be surprising
01h 01mDynamic Runtime Code with Roslyn
