Exploring Source Generators
summary
Shows how Roslyn APIs plus NuGet analyzers generate real C#: a Json serialization Source Generator that precompiles read/write logic (claiming ≈40% faster startup in some caching benchmarks), a logging generator that emits isEnabled checks and structs, a regex generator, LibraryImport/JS import marshalling for .NET 7, and a custom auto‑notify + builder generator built and validated via unit tests and Verify testing. Visual Studio 2022’s incremental generators reduce IDE rework; generators run, emit diagnostics, and the demos compile and execute.
AI-written summary · about
chapters (15)
- 0:00Source Generators intro
- 1:07Why Source Generators
- 8:39Built-in .NET 6/7 generators
- 14:56Json Serialization with generators
- 15:16Logging optimization
- 18:18Razor views pre-compiled
- 20:03Regex compilation in .NET 7
- 22:13Native interop library import
- 26:47WebAssembly JS interop
- 30:07Custom generator tutorial
- 42:14Incremental generators in VS 2022
- 45:26Advanced generator features
- 49:43Deploying generators
- 51:07Real-world examples
- 51:57Q&A
related talks
01h 02mRoslyn Source Generators Never send a human to do a machine's job
01h 12mC# Source Generators in Action
01h 15mLet’s Build an Incremental Source Generator With Roslyn
01h 00mLet's Code an incremental source generator with Roslyn
01h 04mLet's Code an incremental source generator with Roslyn
42mC# Code Generators: Writing Code That Writes Code
50mImproving Source Code with Roslyn
59mAutomating Observability With Roslyn Source Generators
