question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SuppressMessageAttribute not working with namespaces

See original GitHub issue

I am trying to uses the GlobalSuppressions file to suppress a specific rule on a specific namespace on my test project, like so:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "CC0061", Scope = "namespace", Target = "CodeCracker.Test.Design", Justification = "No need for tests to have async sufix.")]

But it does not work. The diagnostic keeps being generated. The method specific works:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "CC0061:TaskNameAsyncAnalyzer", Justification = "No need for tests to have async sufix.", Scope = "member", Target = "~M:CodeCracker.Test.Design.CopyEventToVariableBeforeFireTests.IgnoreMemberAccess")]

I guess this is a bug, right?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
giggiocommented, Feb 13, 2015

Ok, this is insufficient. The ability to suppress a diagnostic on a specific namespace, including all its types, is really important. I am seeing that there is no way to do this today? May I suggest that feature? 😃

6reactions
giggiocommented, Feb 12, 2015

Ok, it makes sense not to break everyone. But how would then I suppress diagnostics against types inside the namespace? Is that at all possible? Or will I have to add each one individually? This would be really annoying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - 'SuppressMessage' for a whole namespace
Open your assembly in FXCop 10 (System.Xml here) and run analysis · Select your namespace (System.Xml here) · Select all violated rules ·...
Read more >
Suppress code analysis violations - Visual Studio (Windows)
This scope suppresses warnings in a namespace and all its descendant symbols. The namespaceanddescendants value is ignored by legacy analysis.
Read more >
Impossible to suppress code analysis warning at ...
We have to put a suppression on every declaration, which litters code with text not adding any value to the product. Visual Studiowindows...
Read more >
Suppress NDepend Issues
For a SuppressMessage attribute, the scope is incompatible with the Target. For example scopes module and namespace are incompatible if the target element...
Read more >
How to: Suppress violations in rule reports
This article explains how to suppress violations in rule reports. Sometimes the analysis reports potential issues which should not appear in the reports....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found