7

In VS 2019, unused parameters are now showing two issues in the "Error List" instead on one: CA1801, which appears as a warning, and IDE0060, which appears as a suggestion.

Do these analysis rules do the same thing? If not, how are they different. If so, why are they duplicated?

Dan Friedman
  • 4,941
  • 2
  • 41
  • 65

1 Answers1

1

Different tools, different implementations of the same idea. The duplication is caused by the rule being implemented by both Visual Studio (IDE0060) and FxCop (CA1801). Yet another duplicate comes from SonarQube analyzers (S1172).

The FxCop rule is also implemented by the legacy code analysis, which is not based on Roslyn. This implementation differs in details as described in the CA1801 rule's documentation. Same rule name, different implementations.

Being separate implementations, they all most probably differ in details. I don't think these details should matter much -- the intent behind the rules is the same.

Palec
  • 12,743
  • 8
  • 69
  • 138
  • I've got a .NET 4.8 project. On the Code Analysis tab of the Project Properties, I've unchecked Run on Build under Binary Analyzers. Shouldn't that have stopped CA1801 from showing up in my Error List? Somehow I'm getting both errors the OP did, but I think that checkbox disables FXCop, so ... what am I missing?? (Thx!) – pbristow Mar 12 '20 at 21:04
  • @pbarranis The code-analysis situation for .NET Framework projects in Visual Studio 2019 is totally messed-up... and things change with every point-release too. Check your VS Extensions and project NuGet packages too. – Dai Aug 26 '21 at 05:47