World Congress 2026 Europe Jul 9, 2026 Session details

Code that writes code - .NET Source generators

Glenn F. Henriksen

Tired of writing repetitive boilerplate or relying on slow runtime reflection? Discover how .NET source generators hook into the compiler to automatically write AOT-compatible C# for you.

Pause
Mute Enter Fullscreen
#1 about 3 min

Understanding the basics of .NET source generators

Hook into the Roslyn compiler pipeline to deterministically generate C# code based on existing syntax trees.

#2 about 4 min

Implementing a basic source generator pipeline

Create an IIncrementalGenerator implementation to register and output generated source code files automatically during build time.

#3 about 7 min

Generating strongly typed identifiers to replace boilerplate

Use partial structs and the Roslyn syntax tree to automatically generate boilerplate comparison and serialization code.

#4 about 4 min

Generating C# code from external configuration files

Utilize the AdditionalTextProvider approach to inspect and generate native code directly from external unmanaged files.

#5 about 5 min

Raising build errors with custom diagnostic messages

Validate object mapping constraints at compile time by analyzing semantics and reporting explicit diagnostic build errors.

#6 about 6 min

Testing and debugging source generator output files

Verify generated code structures reliably using snapshot testing instead of relying purely on fragile debugger attachment setups.

#7 about 2 min

Best practices and optimization tips for compilation

Maintain fast incremental compilation phases by keeping search predicates short and caching minimally sized transform models.

#8 about 4 min

Replacing runtime reflection with native compilation features

Replace runtime reflection bottlenecks with compile-time steps and explore framework features that leverage generated components natively.

Matching moments

1:52 min

Overview of C# source generators and compilation pipeline

Jiří Činčura · WWC 2021

6:12 min

Common use cases for source code generation scenarios

Jiří Činčura · WWC 2021

1:29 min

Addressing iterative code generation and developer challenges

2:44 min

Using code generation to enable smaller development teams

Eric Bowman Eric Bowman · WWC Europe 2026

2:49 min

Accelerating software engineering velocity with automated code generation

Tim Berners-Lee · WWC 2023

11:41 min

Generative artificial intelligence and programming fundamentals

Chris Heilmann +2 · LIVE

Upcoming sessions on this topic

Open session

World Congress 2026 North America

The Broken Rung: How AI is Rebuilding Software Development from the Ground Up

Tomislav Tipurić

Chief Technology Officer, Nephos

Tomislav Tipurić
Open session

World Congress 2026 North America

When Humans Stop Writing Code: Rethinking Languages, Compilers, and Responsibility

Simon Auer

Organizer of flutter vienna meetup and CEO of marqably

Simon Auer
Open session

World Congress 2026 North America

Building Stuff with GenAI - The Open Minded Workshop beyond OpenAI

Andreas Erben

CTO for Applied AI and Metaverse at daenet

Andreas Erben
Open session

World Congress 2026 North America

Beyond Vibe Coding: Using CLI Tools as Your AI Counterpart in Pair Programming

Ron Veen

Java enthusiast and Special agent for Team Rockstars IT

Ron Veen
Open session

World Congress 2026 North America

Ship 10x Faster: AI-Powered Development with Claude Code and MCP Tools

Viktoria Semaan

Principal Technical Evangelist at Databricks

Viktoria Semaan
Open session

World Congress 2026 North America

The spectrum of agentic coding: From vibe coding to high-quality software engineering

YK Sugi

Developer Experience Manager at Eventual

YK Sugi