csharp-source-generators

Source generators

A collection of C# source generator projects and resources

A list of C# Source Generators (not necessarily awesome) and associated resources: articles, talks, demos.

GitHub

2k stars
81 watching
204 forks
last commit: 4 months ago
Linked from 1 awesome list

awesome-listcsharpcsharp-sourcegeneratordotnetlistroslyn

C# Source Generators / Documentation and samples

docs.microsoft.com official documentation
dotnet/roslyn feature design document 19,064 6 days ago describing the compiler feature
dotnet/roslyn cookbook 19,064 6 days ago to help with generator creation
dotnet/roslyn-sdk samples 516 24 days ago show how to implement a source generator and use features like external package references ( generators). Includes AutoNotify, Csv, Maths, Mustache, and SettingsXml
SourceGeneratorPlayground an online Source Generator Playground to play with generator ideas 💡 without any setup noise.
davidwengier/SourceGeneratorTemplate 181 over 2 years ago A basic template for writing a C# source generator, from the Roslyn dev

C# Source Generators / Source Generators / Dependency Injection (IoC Container)

AutoCtor 84 6 days ago AutoCtor is a Roslyn Source Generator that will automatically create a constructor for your class for use with constructor Dependency Injection
AutoRegisterInject 73 5 months ago Automatically generate Microsoft Dependency Injection ServiceCollection registrations for your classes from attributes
DependencyInjection.SourceGenerators 6 5 months ago This project is a C# source generator designed to simplify and automate the registration of dependencies in Microsoft's Dependency Injection service collection. By using this package, developers can enhance the clarity and efficiency of their code by reducing the need for manual service registration
DependencyManagement 11 about 2 years ago The Dependency Management is a very fast dependency injection and components container, with many interesting features, and without reflection
GrpcInjection 7 over 2 years ago - GrpcInjection is a tool that allow you to inject Services and Interceptor in time of compilation inside of GRPC Projects using C# source generator
Injectio 134 7 days ago - Source generator that helps register discovered services in the dependency injection container
Jab 1,044 10 months ago - Compile Time Dependency Injection
lambdajection 16 9 months ago Framework for building AWS Lambdas using dependency injection and aspect-oriented programming
MrMeeseeks.DIE 7 11 days ago An unambigous, convenient, flexible and feature rich compile time dependency injection container
Pure.DI 521 6 days ago - dependency injection for .NET without any IoC/DI containers, frameworks, dependencies, and thus without any performance impact and side-effects
SourceInject 79 about 2 years ago A source generator that allow you to generate your services for dependencies injection during compile time
StrongInject 849 over 2 years ago - compile time dependency injection for .NET
Thunderboltloc 57 over 1 year ago One of the very first IoC frameworks for .Net that has no reflection

C# Source Generators / Source Generators / Console / CLI

AutoSpectre 21 5 months ago Generates a service for prompting and populating a class using the Spectre.Console library
docopt.net 355 4 months ago generates C# source code that parses command-line arguments into a strong-typed arguments class (also generated), given the as part of the CLI. In other words, write the help message for your program and get the entire parser generated for free!
Figgle 433 4 months ago - Generate ASCII banner text at compile time (or run time) using figlet fonts

C# Source Generators / Source Generators / Mappers

AutoDto 24 about 1 year ago - A source generator that generates DTO models from BL to avoid same BL and DTO models
Flattening 27 over 3 years ago - C# source generator for generating flattened classes from complex domain classes
GraphQL.Tools 95 about 3 years ago - A GraphQL to C# compiler (code-generator) which turns your GraphQL schema into a set of C# classes, interfaces, and enums
Mapperly 2,927 8 days ago - A source generator for generating object mappings. Inspired by MapStruct
MappingCloningExtensions 2 9 months ago Generates extensions of objects for mapping and cloning using either attributes or fluent style. Also, supports deep copying and specfiying whether it can do a deep copy and the possibility of doing so safely
Mapster 4,383 5 months ago - A fast, fun and performant object to object Mapper. Has better performance and is more memorry efficient than Automapper. Besides code generation, supports also Fluent API
MapTo 94 2 months ago - A convention based object to object mapper similar to Automapper
NextGenMapper 42 about 1 month ago Easy-to-use mapper without configuration
SourceMapper 8 over 2 years ago - generates Mappers code based on attributes used on interfaces or abstract classes. It is inspired by Java
SourceMapper 5 about 3 years ago A source generator that creates extension methods for cloning and mapping

C# Source Generators / Source Generators / Communication

CoreWCF 1,658 13 days ago CoreWCF provides support of WCF server side code on .NET Core / .NET6. CoreWCF allows users to inject services into implementation using a source generator to provide an implementation that fits the expected . The supplied implementation fetch services from the DI container the same way the attribute works in ASP.NET core MVC Controllers. The source generator supports both a dedicated attribute and the ASP.NET Core MVC attribute
Imp.NET 40 almost 3 years ago - a fast, high-level, object-oriented C# networking library that supports the invocation of remote methods through proxy interface objects
IoTHubClientGenerator 17 about 1 year ago Build a C# Azure IoT Device client program in seconds!

C# Source Generators / Source Generators / Graphics / Drawing

ComputeSharp 2,775 8 days ago A .NET library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders, which are transpiled from C# and precompiled at build-time using source generators
Svg to C# Source Generators 472 21 days ago SVGC compiles SVG drawing markup to C# using SkiaSharp as rendering engine. SVGC can be also used as codegen for upcoming C# 9 Source Generator feature

C# Source Generators / Source Generators / Enums

BetterEnums 39 8 months ago C# Enums with values and better performance as a source generator
Credfeto.Enumeration.Source.Generation 19 6 days ago Enum to text generator for enums - generates strongly typed enums for all enums in the assembly, and using attribute for third party enums. Also includes an analyzer to ensure that all enum usages use the extension method rather than
Enum.Source.Generator 180 20 days ago A C# source generator to create an enumeration (enum) class from an enum type. With this package, you can work on enums very, very fast without using reflection
EnumClass 4 over 1 year ago Generate Kotlin's from C# with additional features like Switch function (instead of statement). It also contains support libraries like generator for JsonConverter for generated classes
EnumerationClassGenerator 16 over 2 years ago - A C# source generator to create an enumeration class from an enum type
EnumFastToStringDotNet 31 over 2 years ago - Automatically generates enum extension methods that implement a switch expression based ToString method
EnumUtilitiesGenerator 23 over 2 years ago - A source generator to generate compile-time mapping of enums and description attributes
FastEnumGenerator 1 almost 3 years ago An enum like generator where you create a partial class with private enum and it will generate an enum like record struct even including returning the words and a list
JOS.Enumeration 25 6 days ago Enumeration class powered by source generation

C# Source Generators / Source Generators / Functional Programming

Generator.Equals 136 about 1 month ago generates equality and hashing for classes and records, supports a number of strategies for comparing collections and properties
RSCG_UtilityTypes 4 11 months ago Add Omit and Pick attributes to generate classes from existing class, like in TypeScript
Strongly 35 6 months ago Easily generate serializable domain value types
ValueObjectGenerator 40 almost 4 years ago C# source generator is for ValueObjects (ie.Wrapper classes)
Vogen 883 7 days ago C# source generator and code analyser that generates strongly typed domain identities
WrapperValueObject 53 about 2 years ago - for creating simple value objects wrapping primitive types
Immutype 41 6 days ago - generates extension methods to support immutability
Visor 3 about 1 year ago C# optics library with incremental code generator (maintained fork of )
AnyOf 109 about 2 months ago The Source Generator creates a type to handle multiple defined types as input parameters for methods
dotVariant 70 3 months ago A type-safe and space-efficient sum type for C# (comparable to discriminated unions in C or C++)
Dunet 633 7 days ago A simple source generator for in C#
Funcky Discriminated Unions 6 13 days ago A source generator that generates methods for all your discriminated unions needs. ✨ Can be used with or without the functional programming library Funcky
N.SourceGenerators.UnionTypes 10 7 months ago Discriminated union type source generator
Unions 10 7 months ago for generating meaningful, efficient union types

C# Source Generators / Source Generators / Serialization

AutoDeconstructable 33 about 1 month ago Generator for efficient and automatic flat text serializer/deserializer using in library
Azura 4 almost 3 years ago Generates binary [de]serializers on Streams at design time
CSV-Parser-Generator 5 7 months ago A Parser for CSV with support for uncommon line separators (e.g. Unicode) and instantiation of read-only objects and working nullable handling
ProtobufSourceGenerator 12 23 days ago - A source generator that generates partial helper classes where member properties are attributed with ProtoMember attribute
SerdeDn (serde-sn) 156 about 1 month ago is a port of the popular Rust serialization/deserialization library to .NET. Basic cases are fully automated using a C# source generator
SpreadCheetah 309 11 days ago Create Excel files with a C# Source Generator for generating the rows
StackXML 49 almost 2 years ago Stack based zero-allocation XML serializer and deserializer
StructPacker 76 over 2 years ago binary serializer that auto-generates C# serialization code to achieve peak runtime performance and efficiency
Tinyhand 19 6 days ago - Tiny and simple data format/serializer using a source generator
GeneratedJsonConverters 4 6 days ago - generate json converters for polymorph contracts and string based enum serialization
JsonByExampleGenerator 78 almost 2 years ago - generate classes based on example json files in your project
JsonDeserializeResourceSourceGenerator 2 about 2 years ago Instead of having to do embedded resource, can instead have json as additional file and it will produce a c# string and will deserialize to a type specified
JsonPolymorphicGenerator 8 over 1 year ago - Source Code Generator for System.Text.Json JsonDerivedType attributes on polymorphic classes
JsonSerializerContextGenerator 2 almost 3 years ago A source generator that produces nearly the same code ahs system.json.text but easier to use because you only have to put an attribute for a model class you want to produce for. Also, produces a method to register to make it easy to use that source generator when serializing/deserializing json
JsonSrcGen 147 over 3 years ago - compile time JSON serializer generation
TeuJson 1 10 months ago A Reflection-less and Lightweight Json Library using source generator

C# Source Generators / Source Generators / Localization

kli.Localize 33 2 months ago - localize strings from json files via source code generation
MrMeeseeks.ResXToViewModelGenerator 6 9 months ago Takes ResX files and generates localization ViewModels for a more convenient usage of localization in MVVM projects
ResXGenerator 32 6 months ago Generates strongly-typed resource classes for looking up localized strings

C# Source Generators / Source Generators / Testing

Buildenator 19 19 days ago Generate data builder classes for testing purposes (and not only) for your entities. Autofixture + Moq extensions
FluentAssertions.Eventual 5 9 months ago - Generates a specialized waiting wrapper for assertions, offering a syntax similar to plain
ScenarioTests 46 almost 2 years ago Test your code like you would write a notebook. Simply and effective
GRPC-Mock-Server 32 7 days ago - A source generator for stubbing GRPC services
InterfaceGenerator 36 6 months ago - Auto generate interface definition by implementation, for when you need an abstraction for the sake of mocking
MockableStaticGenerator 14 about 2 years ago A C# source generator to make an interface and a class wrapper to test static/extension methods
MockGen 16 almost 3 years ago A C# mocking library based on source generators
MockSourceGenerator 11 almost 4 years ago A C# mocking library that generates mocks at compile-time using a source generator
ProxyInterfaceGenerator 39 12 days ago generate an interface and a Proxy class for classes. This makes it possible to wrap external classes which do not have an interface, in a Proxy class which makes it easier to Mock and use DI
Rocks 257 15 days ago A mocking library based on the Compiler APIs (Roslyn + Mocks)

C# Source Generators / Source Generators / Patterns

Lombok.NET 313 about 1 month ago Generates boilerplate code and common code patterns. As the name suggests, it is the .NET version of Java's Lombok
DumplingsDevs.Pipelines 43 about 1 year ago The most flexible mediation implementation in the .NET ecosystem with your own types
Immediate.Handlers 65 8 days ago An implementation of the Mediator pattern in .NET using source generators, without using a central mediator instance
Mediator 2,151 5 months ago - a high performance implementation of Mediator pattern in .NET using source generators
MediatR controllers generator 37 over 1 year ago This generator generates controllers and their methods based on your requests
Plastic 59 5 months ago This project provides encapsulation of things like Domain, Application Rules, Business Rules or Business Logic in Application
Data Builder Generator 116 3 months ago Generate data builder patterns for your model classes
FluentBuilder 173 13 days ago - A project which uses Source Generation to create a FluentBuilder for a specified model or DTO
M31.FluentAPI 98 25 days ago - Generate fluent APIs for your C# classes with ease
avatar 138 over 1 year ago A modern compile-time generated interception/proxy library
DudNet 3 about 1 year ago A C# source generator for implementing a proxy pattern
MrMeeseeks.Visitor 2 over 1 year ago Generates the boilerplate code for applications of the Visitor pattern
AutoInterface 76 3 months ago interface-to-member source generator

C# Source Generators / Source Generators / Domain Driven Design (DDD)

AltaSoft.DomainPrimitives 53 3 months ago - A C# toolkit purposefully designed to accelerate the development of domain-specific primitives within your applications. This streamlined solution empowers developers to efficiently encapsulate fundamental domain logic. Through this toolkit, you'll significantly reduce code complexity while improving the maintainability of your project
Architect.DomainModeling 64 11 months ago A complete Domain-Driven Design (DDD) toolset for implementing domain models, including base types and source generators for ValueObjects, WrapperValueObjects, Entities, and Identities

C# Source Generators / Source Generators / Metaprogramming

GenerateHelperLibraries 1 8 months ago A source generator where you can send any code to the client without having to do as a string. Helper for custom classes a client has to override in order to have additional features for source generators. Intended to be used from another source generator
Gobie 97 over 1 year ago - Allows developers define and use custom source generation without writing any generator code themselves or learning the Roslyn APIs. Instead, devs define the generator they want, in C#, and can then use that generator throughout their project
Matryoshki 28 about 2 months ago Metaprogramming framework based on C# source generators. It allows you to define behaviours with adornments and generate decorators for arbitrary types
SourceGeneratorQuery 22 almost 2 years ago - C# SourceGenerator helper which helps you query your files, and adds LINQ support

C# Source Generators / Source Generators / Webprogramming

AjaxService.Gen 20 11 months ago - Automatically Generate typescript Ajax calls based on your C# Api endpoints
ApiClientGenerator 19 6 months ago Generates a strongly typed HttpClient based off MVC's default routing. Can be used to output into multiple projects, like Blazor WebAssembly
ControllerGenerator 8 over 1 year ago Automatically generate controllers from services in a web application
HttpClientCodeGenerator 45 about 3 years ago - HttpClientGenerator is a tool that uses the Roslyn code generator feature to write boilerplate HttpClient code for you
Ridge 50 12 months ago Generates strongly-typed clients for API based on controller definition and internal application details
Safe-Routing 31 2 months ago Analyses a project's razor pages and MVC controllers, producing strongly-typed representations of those routes as you type
TypedSignalR.Client 147 8 days ago C# Source Generator to create strongly typed SignalR clients
H.NSwag.Generator 21 about 2 months ago - C# Source Generator for NSwag
SourceApi 14 almost 3 years ago - API first Open API code generator based on json or yaml definitions. It generates base abstract controllers with docs, routes, that you inherit and implement in your controllers
ST.NSwag.ServerSourceGenerator 4 almost 2 years ago Generates Web API/ASP.NET Core controllers from a OpenAPI specification
BlazorInteropGenerator 15 11 months ago Generates Blazor -> Javascript strongly typed interop methods, by parsing the Javascript it self and generating extension methods for IJSRuntime
BlazorOcticons 21 7 months ago Github created as a components using source generator. The generated components are available via the NuGet package, the generator itself is available as a separate NuGet package. The project is an example using the generated components
MiniRazor 224 over 1 year ago Portable Razor compiler & code generator
RazorPageRouteGenerator 13 5 months ago Generates methods with parameters for Razor and Blazor pages, so you can navigate without having to guess URLs or parameters

C# Source Generators / Source Generators / XAML / WPF / Avalonia

Avalonia.NameGenerator 85 over 1 year ago Generates typed references to named XAML controls
boilerplatezero 37 about 1 year ago WPF Dependency Property and Routed Event generator
DependencyPropertyGenerator 117 10 days ago Dependency property and routed event source generator for WPF/UWP/WinUI/Uno/Avalonia/MAUI platforms
WinUI-ObservableSettings 5 about 1 year ago - Generate boilerplates to read and write settings in packaged WinUI 3 app
PropertyChanged.SourceGenerator 139 4 months ago - Powerful INotifyPropertyChanged Source Generator, which generates INPC boilerplate for you as part of your build. Supports features such as automatic and manual dependencies between properties, notifications when specific properties change, and more
ValueChangedGenerator 13 over 1 year ago for generating PropertyChanged from inner struct members
DevExpress.Mvvm.CodeGenerators 41 8 days ago Generates boilerplate code for your View Models (INotifyPropertyChanged, Commands, IDataErrorInfo, DevExpress services). Compatible with the Prism and MVVM Light libraries
Microsoft MVVM Toolkit 3,064 7 days ago A modular MVVM library with support for source generators to reduce boilrplate and improve performance
MvvmGen 255 11 months ago A lightweight MVVM library for XAML applications that generates your ViewModels with a C# Source Generator

C# Source Generators / Source Generators / Database / ORM

AdaskoTheBeAsT.Identity.Dapper 7 25 days ago - Custom Dapper implementation for Microsoft.Extensions.Identity.Stores (part of ASP.NET Core Identity)
Breezy 24 about 1 year ago Micro ORM with source generator
MapDataReader 64 7 months ago - Fast mapping to a custom class
SqlMarshal 59 3 months ago Native AOT friendly-performant mini-ORM. Generation of wrappers for accessing SQL using ADO.NET

C# Source Generators / Source Generators / Statically typed resources / configurations

dot-env-generator 32 about 2 years ago A source generator for C# that turns files into runtime constants
EnvVariablesGenerator 3 9 months ago Generate code from files that can be changed after build
NotNot.AppSettings 28 19 days ago Automatically create strongly typed C# settings objects from AppSettings.json
SourceConfig 12 4 months ago - Generates configuration POCO objects, lists, dictionaries in AOT based on *.json config files
StronglyTypedEmbeddedResources 9 about 1 year ago Generates strongly typed names for Embedded Resources automatically
TxtToListGenerator 0 almost 3 years ago A source generator where if you have a text file as additional file and you have a list ordered by return carriages, then it produces either a list of int or a list of string in c#

C# Source Generators / Source Generators / Text templating

Transplator 31 about 2 years ago A simple C# source generator for text templates
Weave 23 12 months ago Weave is a text templating engine for .NET that is all about attention to detail. Weave handles the tricky work of making your rendered text beautiful

C# Source Generators / Source Generators / Other

AutoConstructor 49 20 days ago C# source generator that generates a constructor from readonly fields/properties in a class or struct
AutoFilterer.Generators 463 8 months ago AutoFilterer.Generators aims to generate filter DTOs from entities automatically via using dotnet source generators
AutomaticInterface 61 3 months ago Generate an Interface from a class
AutoInvoke 9 7 months ago A generator that generates a method that invokes a specified generic method, for every Type in your project that satisfies a defined constraint
BigMachines 37 6 days ago BigMachines is State Machine library for .NET
BitsKit 41 3 months ago A C# library for efficient bit-level reading and writing also adding bit field support
CacheSourceGenerator 4 7 months ago Generates an IMemoryCache wrapper around a method call
Cloneable 72 over 1 year ago auto-generate Clone method
Durian 57 about 2 years ago Extends the default capabilities of C# by mimicking features from other languages
Fairy 4 almost 4 years ago generates C# code based on Sitecore Content Serialization (SCS) files
FastGenericNew 240 25 days ago The ultimate fast alternative to / . Built on SourceGenerator V2 (Incremental Generator)
GitBuildInfo.SourceGenerator 38 over 2 years ago - for dumping the git information (commit hash, branch, the head description) into assembly level metadata attributes
Hangfire.RecurringJob 4 7 months ago - Automatically generates the recurring job registration code
IDisposableGenerator 15 7 months ago - a Source Generator for Generating the Dispose functions in Disposables. All you have to do is mark them with attributes and it will work from there
Lazysh 7 over 1 year ago Lazy implementation of any interface
LinqGen 287 5 months ago Alloc-free and fast replacement for Linq, with code generation
LoggingDecoratorGenerator 14 10 months ago Generates logger decorator class for an interface. Uses Microsoft.Extensions.Logging.ILogger to log and requires it in decorator class constructor
MemberAccessGenerator 7 over 4 years ago generates and/or methods that return property value for a given property name or index (e.g. in positional records)
MrMeeseeks.StaticDelegateGenerator 8 over 3 years ago Makes static classes and members injectable as dependency by generating delegating interfaces and their implementing classes
Navitski.Crystalized 8 5 months ago Generates domain model based on schema files. Generated model supports undo/redo, saving to/loading from SQLite and Json files, precise changes tracking and more
net_automatic_interface 61 3 months ago .Net Core Source Generator for Automatic Interfaces
PolySharp 1,807 6 days ago Provides generated, source-only polyfills for C# language features, to easily use all runtime-agnostic features downlevel
PrimaryConstructor 105 10 months ago Generate primary constructor from readonly fields
PrimitiveStaticDataGenerator 9 about 2 months ago for creating methods that return optimized static data from primitive values
PrintMembersGenerator 6 about 4 years ago helps re-defining C# record's PrintMembers method to force include/exclude certain members
QuickConstructor 26 over 2 years ago A reliable and feature-rich source generator that can automatically emit a constructor from the fields and properties of a class. It can also generate null checks based on nullable reference types annotations
SmallSharp 286 7 days ago Create, edit and run multiple C# 9.0 top-level programs in the same project by just selecting the startup program from the start button
SmartAnnotations 56 over 3 years ago A library that uses source generators to automatically generate data annotations for your models. It provides a strongly-typed mechanism (fluent like API) to define your annotation rules
StringLiteralGenerator 135 3 months ago for optimizing UTF-8 binaries
SyncMethodGenerator 48 4 months ago - Generates a synchronized method from your async code
ThisAssembly 437 8 days ago Exposes project and assembly level information as constants in the ThisAssembly class
ToString 18 almost 2 years ago - C# source generator for implementing override like type
TupleOverloadGenerator 5 about 2 years ago - Overload array parameter with tuples avoiding heap allocations
ValueLink 8 6 days ago A C# Library for creating and managing multiple links between objects

C# Source Generators / Meta - libs and generators for other generators

AttributeFactoryGenerator 1 12 months ago - Generate factories to easily parse actual attribute instances from symbol data
AttributesSourceGeneratorHelper 2 over 1 year ago A source generator to help another generator by producing attributes. Anything that inherits from Attribute will be sent to the client so you don't have to build strings for attributes
CommonSourceGeneratorsHelpers 11 7 months ago A generator to create many helpers for source generators to use to make up that its very difficult to reference third party libraries in source generators including extensions and a source code string builder
HotReload 3 12 months ago - A simple hack to enable hot reload in Visual Studio Intellisense when developing a source generator project together with an example dependent client project inside a single solution
SourceGeneratorUtils 21 about 1 year ago An essential library equipped with utility functions and helpers to aid in writing source files for source generators or for general purposes. Based on the source generator architecture for best-practices
SourceGenerator.Helper.CopyCode 7 7 months ago - A simple Generator that generates a string representation to an annotated Type

C# Source Generators / Articles

Series: Creating a source generator (2022-02-01) Complete series about how to create an incremental source generator, using the APIs introduced in .NET 6
Mastering at Source Generators (2022-01-15) Generating CRUD controller from DTO model using text template
Using C# Source Generators to create an external DSL (2021-01-27) that shows how to implement a simple DSL
4 ways to generate code in C# — Including Source Generators in .NET 5 (2021-01-19) demonstrates the comparison between Source Generators, T4 template and Reflection, etc
.NET 5 Source Generators - MediatR - CQRS - OMG! (2020-12-16) explores how source generators can be used to automatically generate an API for a system using the MediatR library and the CQRS pattern
Source Generators in .NET 5 with ReSharper (2020-11-20) introduces source generators and briefly mentions how they are being worked into the ReSharper product
Source Generators - real world example (2020-11-09) contains a rich and deep dive into a real world generator with lots of useful tips
How to profile C# 9.0 Source Generators (2020-10-10) demonstrates how to profile your source generator using the
How to Debug C# 9 Source Code Generators (2020-10-09) contains debugging tips
How to generate code using Roslyn source generators in real world scenarios (2020-09-17) rich story of how ThisAssembly generator was written using Scriban templates
.NET Blog 'New C# Source Generator Samples' post (2020-08-25) that shows some simple samples
.NET Blog 'Introducing C# Source Generators' post (2020-04-29) that announces the feature

C# Source Generators / Videos

C# Source Generators - Write code that writes code - David Wengier (2020-11-13) Roslyn dev takes deep dive into the topic
.NET Languages and Runtime Community Standup - Source Generators (2020-10-08) shows how Generators work and how they can be tested
Channel 9 'Source Generators in C#' (2020-08-12) has Roslyn PMs discussing the feature

C# Source Generators / Demo, PoC and excercise projects

RyanAlameddine/SourceGeneratorDemo 3 over 3 years ago contains 3 demos: hello world, INPC and OpCode class
TMC-CSharp/CodeExerciseLibrary 2 almost 4 years ago Library to help creating C# exercises. Generates missing methods and classes inside tests on the fly by using Source Generators
DpdtInject 32 over 2 years ago DI container based on C# Source Generators. Its goal is to remove everything possible from runtime and make resolving process as faster as we can. This is achieved by transferring huge piece of resolving logic to the compilation stage into the source generator
jakubsturc/talk-csharp-source-generators 3 over 4 years ago contains 4 generators: AutoNotify, ConsoleWritelineHijack, HelloWorld and SettingsXml, plus nice presentation slides
Compile Time Method Execution Generator 20 about 4 years ago proof of concept that allows executing a method during compilation, so that it can be really fast during runtime

C# Source Generators / Projects using custom Source Generators "internally"

Elskom/Sdk 6 3 months ago Dumps git repository data to assembly level metadata attributes that can be checked at runtime for things like trapping if a user is using an possibly unstable build of the libraries built in the repository and so the user can see a message about it (and optionally opt into running the possibly unstable code)
Heroicons.AspNetCore 13 about 1 month ago that are easy to use in ASP.NET Core MVC as TagHelpers
NetFabric.Hyperlinq 876 9 months ago generates overloads for its extension methods
RestEase 1,084 12 months ago uses Source Generator to generate interface implementations on compile time instead of in runtime via Reflection.Emit
WarHub/wham 21 7 months ago generates code for immutable tree object graph based on red-green node approach used in Roslyn; generates custom XmlSerializer that supports C#9 records and ImmutableArray

Backlinks from these awesome lists:

More related projects: