~/talk

Roslyn Source Generators Never send a human to do a machine's job

Talkat NDC Oslo 2021 · 2021-11-29..12-03· [compilers-and-language-design, dotnet]
slides:none on file

Explains concrete mechanics: C# 9 adds partial methods with visibility and module initializers that let Roslyn generators emit implementations at compile time; .NET 6 ships System.Text.Json source generator and logging generators to remove reflection. Shows generator anatomy (ISourceGenerator, Initialize/Execute or Incremental generators in Roslyn 4.0), testing with Microsoft.CodeAnalysis.Testing, packaging to NuGet (analyzers under analyzers/netstandard2.0), debugging tips, and a benchmark where generated enum-to-string runs ~1.6ns vs 25ns for reflection.

AI-written summary · about

  1. 0:00Start
  2. 3:43Support for Source Generators
  3. 5:47Module Initializers
  4. 7:15The Laws of Source Generation with Rustling
  5. 11:19Vlogging
  6. 19:34Syntax Receiver
  7. 24:24Testing
  8. 31:54Syntax Visualizer
  9. 33:54Debugging
  10. 34:41Define a Launch Profile
  11. 40:09Versioning
  12. 45:33Syntax Provider
  13. 46:46Incremental Source Generators
  14. 55:10Are There any Reasons Not To Always Use the Incremental Generator
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.