~/talk

Let's Code an incremental source generator with Roslyn

Talkat NDC London 2023 · 2023-01-23..01-27· [c-sharp, compilers-and-language-design]
slides:none on file

Live codes an incremental Roslyn source generator that emits enum IsDefined methods as compile-time partial methods, using .NET 6 incremental APIs and post‑initialization to inject a marker attribute. Pipeline uses the SyntaxProvider .ForAttributeWithMetadataName and produces a single hint file via Source generator produces partial methods. Benchmarks with BenchmarkDotNet show the generated code matches a hand‑written fast check (~15 ns) and avoids runtime allocations. The pipeline uses collect + comparer for caching so unchanged inputs skip regeneration. Tools shown: Roslyn, Sharlab, Rider/Visual Studio, BenchmarkDotNet.

AI-written summary · about

  1. 0:00Introduction
  2. 2:33Roslyn and extensibility
  3. 10:04Source generator use cases
  4. 15:24Roslyn versioning
  5. 17:32Setup incremental generator
  6. 23:32IIncrementalGenerator
  7. 30:15Generation attribute
  8. 33:07Syntax and semantic analysis
  9. 41:55Incremental pipeline
  10. 47:18Source code output
  11. 55:09Incrementality for performance
  12. 59:31Q&A
~/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.