Search code examples
stylecop

Why isn't this line item StyleCop suppression working?


I have the following, which I gather should disable a stylecop rule on a partiular line of code.

[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules",
                 "SA1300:ElementMustBeginWithUpperCaseLetter", 
                 Justification = "External API, no control")]
public void receivedEvent(NV.nConsumeEvent evt)
{
}

But it has no effect, the warning keeps showing. What's wrong?


Solution

  • It seems that SA1300 belongs to NamingRules, not to the DocumentationRules.

    So, the correct suppressing would be:

    [SuppressMessage(
        "Microsoft.StyleCop.CSharp.NamingRules",
        "SA1300:ElementMustBeginWithUpperCaseLetter", 
        Justification = "External API, no control")]
    public void receivedEvent(NV.nConsumeEvent evt)
    {
    }