Version Used:
Visual Studio 2022 17.0.4
Microsoft.CodeAnalysis.Analyzers 3.3.3
Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.1
Steps to Reproduce:
- Clone the repro project
- Open
SourceGenerator.IntellisenseBug.Demo.sln in Visual Studio 2022 17.0.4
- Build the solution
- Observe the following behavior:

Expected Behavior:
- Intellisense and syntax highlight should continue to work with source-generated code.
- Visual Studio should not report errors in the Errors Window when the build actually succeeds, as per the Output Window.
- List of generated files should be shown in solution explorer under
Analyzers -> SourceGen.IntellisenseBug.Demo instead of "this generator is not generating any files." message.
Actual Behavior:
- Everything works fine up until variable
c11 is declared.
- Intellisense and syntax highlight is broken when
c11 is declared, and never recover afterwards.
- Visual Studio reports errors in the Errors Window, but the build successfully passes
- Solution Explorer shows "this generator is not generating files." message instead of properly showing the generated file.
More details:
The source generator creates a single file with several empty C# classes named Class1, Class2, Class3 and so forth, depending on the number of classes declared in the consuming project in the first variable declaration:
var classes = 5; means there will be Class1 to Class5
var classes = 10; means there will be Class1 to Class10
- and so on.
Using <ProjectReference/> and <PackageReference/> to consume the source generator, in both cases the behavior is the same.
Version Used:
Visual Studio 2022 17.0.4
Microsoft.CodeAnalysis.Analyzers 3.3.3
Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.1
Steps to Reproduce:
SourceGenerator.IntellisenseBug.Demo.slnin Visual Studio 2022 17.0.4Expected Behavior:
Analyzers -> SourceGen.IntellisenseBug.Demoinstead of "this generator is not generating any files." message.Actual Behavior:
c11is declared.c11is declared, and never recover afterwards.More details:
The source generator creates a single file with several empty C# classes named
Class1,Class2,Class3and so forth, depending on the number of classes declared in the consuming project in the first variable declaration:var classes = 5;means there will beClass1toClass5var classes = 10;means there will beClass1toClass10Using
<ProjectReference/>and<PackageReference/>to consume the source generator, in both cases the behavior is the same.