This documentation is archived and is not being maintained.

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 get fixed in the current development cycle. Regardless of the reason, it is often 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 allow a developer to place the decoration that suppresses the warning close to the warning it self.

You can use the Error List window to suppress managed code analysis warnings. Suppressing a warning is different 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.

To suppress a warning using menu item

  1. In the Error List, select the warning.

  2. Right-click the warning, and then choose Suppress Message(s).

    The specific warning is suppressed and the warning appears with a strike through in the Error List window.

NoteNote

To suppress only a single instance of a warning, set the MessageId property of the attribute to the appropriate value.

NoteNote

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

Show: