Search code examples
roslyncsprojroslyn-code-analysis

What are the effects of the "EnforceExtendedAnalyzerRules" flag in the project file


During my work on a Roslyn analyzer I have received an alert from Roslyn analyzer that checks the correct usage of Roslyn API.

RS1036: Specify analyzer banned API enforcement setting.

A project containing analyzers or source generators should specify the property '<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>'.

I tried to google what this property does but did not find any additional information. Here is the link I have already checked:

https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/Microsoft.CodeAnalysis.Analyzers.md#rs1036-specify-analyzer-banned-api-enforcement-setting

Do you know what this flag does?


Solution

  • When this property is set to true, a predefined set of banned symbols are used for the project. You can find the list here (main branch) or here (permalink at the time of writing the answer)

    Check this GitHub issue for more details on why this decision was taken.