PostSharpDeployment and ConfigurationConfigurationWorking with Errors, Warnings, and MessagesIgnoring and Escalating Warnings
Open sandboxFocusImprove this doc

Ignoring and Escalating Warnings

As with conventional compilers, warnings emitted by PostSharp, as well as those emitted by custom code running at build time in PostSharp, can be ignored (in that case they will not be displayed) or escalated into errors.

Warnings can be ignored either globally, using a project-wide setting, or locally for a given element of code. Warnings can be escalated only globally.

Ignoring or escalating warnings globally

There are several ways to ignore or escalate a warning for a complete project:


The value * can be used to escalate all warnings into errors.

Ignoring warnings locally

Most warnings are related to a specific element of code. To disable a specific warning for a specific element of code, add the SuppressWarningAttribute custom attribute to that element of code, or to any enclosing element of code (for instance, adding the attribute to a type will make it effective for all members of this type).

You can create your own custom attribute derived from SuppressWarningAttribute and make it conditional to a compilation symbol by using the ConditionalAttribute custom attribute.