Skip to content

Add Roslyn source generators conceptual overview and incremental generator tutorial#51546

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/improve-roslyn-docs
Draft

Add Roslyn source generators conceptual overview and incremental generator tutorial#51546
Copilot wants to merge 3 commits intomainfrom
copilot/improve-roslyn-docs

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Adds dedicated source generator documentation to the Roslyn SDK section—previously just a one-line external link to the cookbook. Aligned with companion sample code in dotnet/samples#7091.

New docs

  • source-generators-overview.md — What source generators do, incremental pipeline model, input providers (ForAttributeWithMetadataName, AdditionalTextsProvider, AnalyzerConfigOptionsProvider), project setup, debugging, best practices
  • tutorials/incremental-source-generator-tutorial.md — Step-by-step walkthrough building the GenerateMembers generator: marker attribute injection via RegisterPostInitializationOutput, attribute-driven filtering with ForAttributeWithMetadataName, Describe() + PropertyNames code emission

Snippet projects (compile-tested, output-verified)

The tutorial snippets mirror the GenerateMembers sample from dotnet/samples#7091:

[GenerateMembers]
public partial class Person
{
    public string FirstName { get; set; } = string.Empty;
    public string LastName { get; set; } = string.Empty;
    public int Age { get; set; }
}
// → Person.Describe(), Person.PropertyNames generated at compile time

Generator targets netstandard2.0 with Microsoft.CodeAnalysis.CSharp 4.10.0; demo targets net8.0.

Other changes

  • index.md — Replaced external cookbook link with references to new docs + samples repo
  • toc.yml — Added overview and tutorial entries under Roslyn SDK section
  • Overview links to both samples: GenerateMembers (attribute-driven) and CsvGenerator (AdditionalTextsProvider)
Original prompt

I'd like to improve the documentation for Roslyn source generators. In particular, I'd like a conceptual document and a separate tutorial/user guide. Ideally we'd walk through the creation of a simple incremental source generator that the user can follow along with.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…rator tutorial

Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve documentation for Roslyn source generators Add Roslyn source generators overview and incremental generator tutorial Feb 6, 2026
Copilot AI requested a review from agocke February 6, 2026 18:45
…sample

Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot AI changed the title Add Roslyn source generators overview and incremental generator tutorial Add Roslyn source generators conceptual overview and incremental generator tutorial Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants