Dynamic Runtime Code with Roslyn
summary
Roslyn compiles C# into assemblies at runtime so frameworks generate and compile C# into in-memory assemblies and load concrete types on demand; examples include Lamar/Jasper generating route handlers and Refit-style HTTP clients, and Utf8Json using this for fast JSON parsing. This replaces slow reflection and fragile IL or awkward expression trees, yielding reduced allocations and GC pressure and much faster hot paths, but with a real cold-start cost (originally cold start ~4–5s before warmup—now reduced, often mitigated by background compilation). Generated code is previewable and debuggable, improving stack traces.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 0:48About me
- 1:30Tools
- 2:09MVC Core
- 4:50Reflection
- 10:27Adapters
- 12:33Hello World
- 16:54Research
- 18:39Lets get fancy
- 20:25Refid
- 21:43Demo
- 24:39Lamar Compiler
- 27:30Lamar Container
- 30:35Darth Vader
- 31:13Frameworks
- 37:17Generation X
- 38:36Fabu MVC
- 40:27Behaviors
- 45:22Jasper
- 48:19Generated Code
- 56:49HTTP Status Codes
related talks
51mThe Future of C#
50mAutomate Yourself Out Of a Job With Roslyn
56mLowering in C#: What's really going on in your code?
54mExploring Source Generators
01h 00mC# Language Internals
01h 02mHow does Hot Reload even work?
50mImproving Source Code with Roslyn
01h 02mRoslyn Source Generators Never send a human to do a machine's job
