Export (0) Print
Expand All

How to: Suppress Warnings Using Menu Item

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.

You can choose whether the suppression will appear in the source code or in the global suppression file. Some suppressions must be placed in the global suppression file. If this is the case, the In Source option will be disabled.

To suppress a warning by using menu item

  1. On the View menu, click Error List to display the Error List window.

  2. In the Error List, select the warning or warnings to suppress. Multiple warnings can be selected at the same time.

  3. Right-click the warning, point to Suppress Message(s), and click either In Source or In Project Suppression File.

    The specific warning is suppressed, and the warning appears in the Error List window with a strikethrough.

NoteNote:

Suppressions that do not have a target appear in the global suppression file.

Community Additions

ADD
Show:
© 2014 Microsoft