From IL Weaving to Source Generators, the Realm story
summary
Realm .NET moves from Intermediate Language weaving to Source Generators to make generated code readable, debuggable and part of the compile pipeline; migration (first SG release Nov 2022 after ~6 months work) replaces most weaving by generating accessor classes while keeping a tiny, targeted IL weaver because SGs are additive only. Tools used: ILSpy and SharpLab to inspect IL, Roslyn generators for generation. Result: shipped and working, added nullable support and fewer surprises, but full removal needs language features like partial properties and interceptors remain experimental.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 0:50Code generation in .NET
- 1:32IL weaving explained
- 6:05Inspecting IL code
- 9:21Source Generators in .NET
- 14:20Realm database
- 18:53Why code generation
- 19:14Realm’s IL weaving
- 23:50Drawbacks of IL weaving
- 28:10Transition to Source Generators
- 31:25Source Generators advantages
- 34:16Source Generators limitations
- 38:15Realm’s mixed approach
- 42:28Future of code generation
- 46:43Conclusion
related talks
39mFrom IL Weaving to Source Generators, the Realm story
54mExploring Source Generators
01h 02mRoslyn Source Generators Never send a human to do a machine's job
01h 12mC# Source Generators in Action
42mC# Code Generators: Writing Code That Writes Code
01h 00mLet's Code an incremental source generator with Roslyn
01h 15mLet’s Build an Incremental Source Generator With Roslyn
01h 04mLet's Code an incremental source generator with Roslyn
