Code Analysis Suppress Message Attributes in the ShapeAppCSharp Samples

In the ShapeAppCSharp samples included with the VSTA v 2.0 SDK you may notice most types and methods are marked with a System.Diagnostics.CodeAnalysis.SuppressMessage attribute.  These attributes are not involved with the VSTA integration; they are used by the Team Foundation System’s (TFS) code analysis functionality and can be safely removed if not using TFS code analysis (related forum post).

 

 

For more information on these attributes, please refer to the MSDN documentation Suppress Warnings Using SuppressMessage Attribute and In Source Suppression Overview.

 

 

Excerpt from In Source Suppression Overview:
After reviewing the code, you might determine that the code is correct as is. Or, it might be the case that some violations are low priority and will not be fixed in the current development cycle. Regardless of the reason, it is frequently useful to indicate that the warning is non-applicable in order to let the team members know that the code was reviewed and it was determined that the warning be suppressed. In source suppression is useful because it allows a developer to put that suppresses warning close to the warning itself.

You can use the Error List window to suppress managed code analysis warnings. Suppressing a warning differs from disabling it. When you suppress a warning, it applies only to a particular instance of the violation. Other violations of the same warning will still be reported in the Error List window.


Posted Jan 26 2009, 10:58 AM by Melody
Copyright Summit Software Company, 2008. All rights reserved.