Skip to content

Comments

Support dotnet_diagnostic options for source generated files#82470

Draft
333fred wants to merge 8 commits intodotnet:mainfrom
333fred:generated-suppress
Draft

Support dotnet_diagnostic options for source generated files#82470
333fred wants to merge 8 commits intodotnet:mainfrom
333fred:generated-suppress

Conversation

@333fred
Copy link
Member

@333fred 333fred commented Feb 20, 2026

Closes #82285, fixes #41171.

Implements the API proposal from #82285. We now support the following section:

[**/$generated$/**/*.cs]
dotnet_diagnostic.WARN0001.severity = none

The $generated$ path is considered to be relative to the project root. This means that a ** is necessary at the start of many $generated$ paths, since many .editorconfigs live above a project root, not within the project root. Under the project root, the standard generator path is used. This is usually the name of the dll the generator came from, followed by the specific generator in question, followed by the hint name for the file the generator chose. For example, for a generator project/assembly named MyCoolGenerator, a generator inside named GeneratesCoolThings, and a hint name of CoolThing.g.cs, the path from the consuming project root would be $generated$/MyCoolGenerator/MyCoolGenerator.GeneratesCoolThings/CoolThing.g.cs.

@dotnet-policy-service dotnet-policy-service bot added VSCode Needs API Review Needs to be reviewed by the API review council labels Feb 20, 2026
@dotnet-policy-service
Copy link
Contributor

This PR modifies public API files. Please follow the instructions at https://github.com/dotnet/roslyn/blob/main/docs/contributing/API%20Review%20Process.md for ensuring all public APIs are reviewed before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Needs API Review Needs to be reviewed by the API review council VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnalyzerConfigSet.GetOptionsForSourcePath support for [$generated$] sections Suppress warning for generated code

2 participants