Skip to content

Apply source generators to primary project only#1236

Open
kzrnm wants to merge 2 commits intodotnet:mainfrom
kzrnm:NoGenerateInAdditionalProjects
Open

Apply source generators to primary project only#1236
kzrnm wants to merge 2 commits intodotnet:mainfrom
kzrnm:NoGenerateInAdditionalProjects

Conversation

@kzrnm
Copy link
Contributor

@kzrnm kzrnm commented Nov 15, 2025

In VerifyDiagnosticsAsync, analyzers and generators are also applied to AdditionalProjects.
I don’t think this produces the intended test behavior.
More importantly, it’s inconsistent with VerifySourceGeneratorAsync, where generators are applied only to the primary project.

https://github.com/dotnet/roslyn-sdk/blob/f500e81ba5596809e711a3022bf8e80a00c8371b/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest%601.cs#L273C66-L283

@kzrnm kzrnm requested a review from a team as a code owner November 15, 2025 17:05
@kzrnm kzrnm force-pushed the NoGenerateInAdditionalProjects branch from d3b37f8 to 631988a Compare November 15, 2025 17:08
@kzrnm kzrnm force-pushed the NoGenerateInAdditionalProjects branch from 631988a to 32bde08 Compare November 15, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant