开发者

When do I suppress warnings to source vs. Project Suppression File

开发者 https://www.devze.com 2023-01-08 05:17 出处:网络
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 attr开发者_StackOverflow社区i

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 attr开发者_StackOverflow社区ibute is added above the method - Or do I suppress them in the GlobalSuppressioins.cs? Is there any guidance for this, if so where?


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.


Some additional information from MSDN:

MSDN - In Source Suppression

"The global suppression file maintains suppressions that are either global-level suppressions or suppressions that do not specify a target. For example, suppressions for assembly level violations are stored in this file. "

0

精彩评论

暂无评论...
验证码 换一张
取 消