views:

65

answers:

1

I'm working on resolving about 300 warnings and some of the warnings are unnecessary and can be suppressed. However, my question is do I suppress them in the Source - an attribute is added above the method - Or do I suppress them in teh GlobalSuppressioins.cs? Is there any guidance for this, if so where?

Thanks

A: 

The GlobalSuppression.cs file is for SuppressMessage attributes that cannot be placed in the source files. If a suppression can be placed in a source file it should.

Issues that cannot be placed in the source file are things like "namespaces should have at least five classes". You can't place an attribute on a namespace so it goes in the global suppressions file.

Philip Smith
There are suppressions that just seem to clutter the code and I would like to put them in GlobalSuppressions.cs which is why I was asking for some type of guidance. Are you aware of any C#/VS/Microsoft guidance where they direct you were to suppress the different warnings?
Eric U.
@Eric - If you put a suppress message in the .cs file it applies across the whole project. If that is what you want then just turn off the rule. You say clutter, I'd say documents. The attributes tell programmers that a situation has been considered and a resolution decided upon. StyleCop will enforce using the Justification property to document the decision.
Philip Smith
I don't know of any resources describing the use, but I learnt to use fxCop at Microsoft.
Philip Smith