Issue with C# rule RSPEC-1172

For the rule for C# unused parameters, it does not exempt methods used as event handlers and methods referenced by a delegate.

The rule in Sonar:

Exceptions ruled out in .Net code analysis can be read here:

This behavior reduces warning noise on parameters that are needed for signature requirements, for example, a method used as a delegate, a parameter with special attributes, or a parameter whose value is implicitly accessed at run time by a framework but is not referenced in code.

It’s also worth looking at the deprecated CA1801.

This rule does not examine the following kinds of methods:

  • Methods referenced by a delegate.
  • Methods used as event handlers.