~/talk

C# Source Generators - Write code that writes code

Talkat NDC Sydney 2020 · 2020-08-31..09-03· [developer-experience]
slides:none on file

C# 9 adds Roslyn-based source generators that run inside the compiler pipeline, receive parsed syntax trees and Compilation objects, and emit additional C# (by default in-memory) as strings that the compiler reparses and compiles. Generators must target netstandard2.0, register like analyzers, and cannot change existing source or depend on the output of other generators. Practical examples shown: auto‑notify property generation, a DI service locator that emits minimal conditionals, and a WinForms enum validator that moves reflection checks to compile time. Debugging options include GeneratorDriver, Visual Studio previews, and sourcegen.dev.

AI-written summary · about

  1. 0:00Start
  2. 0:56What is a source generator?
  3. 8:36Potentially Frequently Asked Questions
  4. 13:29What can you do with them?
  5. 15:48Diagnostics
  6. 16:40Additional Files
  7. 17:32Usage Notes
  8. 20:17Referencing and Defining a Source Generator
  9. 22:56Reading Syntax
  10. 26:00Reading Symbols
  11. 28:24Generating Syntax
  12. 30:22Debugging a Source 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.