Suggestion to Include Criteria for Identifying Generated Code in AnalysisContext.ConfigureGeneratedCodeAnalysis() Documentation
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 19h 10m
- Merged PRs (30d)
- 268
Description
### Type of issue
Missing information
### Description
Dear .NET Documentation Team,
I am writing to provide feedback on the documentation for the AnalysisContext.ConfigureGeneratedCodeAnalysis() method. Currently, the documentation states:
> Configure analysis mode of generated code for this analyzer. Non-configured analyzers will default to an appropriate default mode for generated code. It is recommended for the analyzer to invoke this API with the required GeneratedCodeAnalysisFlags setting.
However, the criteria for determining whether a piece of code is considered "generated code" are not specified in the documentation.
Upon reviewing the Roslyn source code, it appears that the following criteria are used to identify generated code:
https://github.com/dotnet/roslyn/blob/9951cebdc4f5581a0a06c1355f9f8c033ba0cb70/src/Compilers/Core/Portable/SourceGeneration/GeneratedCodeUtilities.cs
- The file name starts with any of the following strings:
- TemporaryGeneratedFile_
- The file name (excluding the extension) ends with any of the following strings:
- .designer
- .generated
- .g
- .g.i
- The comment at the beginning of the file contains any of the following strings:
-
Contributor guide
Assessment
This issue has not been assessed yet.