1. Why does SuppressMessageAttribute not work?
-
Monday, May 24, 2010 7:22 AM
All Replies
-
Monday, May 24, 2010 7:26 AM
Please check whether you defined CODE_ANALYSIS constant in project properties page because it is a conditional attribute. In Visual Studio 2008, the properties page could be found by right-clicking the project name in Solution Explorer. After it is opened, please select Build tab and enter CODE_ANALYSIS in Conditional compilation symbols box.
Another misunderstanding of this attribute is its Scope, for example, module_level SuppressMessage. The Scope property describes where it is located, not the scope it affects.
More references about SuppressMessageAttribute:
· Suppress Warnings Using SuppressMessage Attribute:
http://msdn.microsoft.com/en-us/library/ms182068(VS.80).aspx· MSDN thread: Module-level SuppressMessage (CA1051):
http://social.msdn.microsoft.com/Forums/en-US/vstscode/thread/dd517e2e-a41d-4ffb-87ce-e2fd508231df- Why does FxCop ignore my in-code SuppressMessageAttribute suppression?
http://blogs.msdn.com/fxcop/archive/2006/03/23/559149.aspx
- Marked As Answer by MSDN FAQ Monday, May 24, 2010 7:29 AM
- Why does FxCop ignore my in-code SuppressMessageAttribute suppression?

