Are FxCopAnalyzers and the .editorconfig file supposed to sync?

257 Views Asked by At

When I add an .editorconfig file to my project, it doesn't match the rules shown in the project's Dependencies > Analyzers.

For example, my .editorconfig file has this:

dotnet_diagnostic.CA2200.severity = error

Yet the analyzer shows this:

enter image description here

Are they supposed to sync? If not, what is the point of the .editorconfig file? When I compile, the rules in Dependencies > Analyzers seems to be followed. How am I supposed to use the .editorconfig file? This is confusing.

Ok, this is maddening. If I change the severity in the .editorconfig file, the compiler respects that and shows errors accordingly. That happens until I make a change in Dependencies > Analyzers, then THAT becomes the source of truth and the .editorconfig file is rendered moot at that point.

It looks like if I set a rule's severity, in Dependencies > Analyzers, to "Default," then the .editorconfig file takes over again.

1

There are 1 best solutions below

0
Bob Horn On

I updated VS from 16.3.8 to 16.7.2. Now .editorconfig is the source of truth. I can no longer change the severity in the project's Dependencies > Analyzers (which is good).