dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.03k stars 4.03k forks source link

Analyzer Semantic Model /w Source Generator #43978

Open macsux opened 4 years ago

macsux commented 4 years ago

Version Used: Microsoft.CodeAnalysis.CSharp.Workspaces 3.6.0-3.final

I'm trying to write an analyzer that is checking that rules introduced by Source Generator are followed. I'm registering for context.RegisterSemanticModelAction(Action);. How can I get a semantic model WITH generated source code already applied?

chsienki commented 4 years ago

The semantic model available to the analyzer should include the generated code.

Is there a repro you have where it isnt?