Share via


.NET Code Analysis Rules

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The Managed Code Analysis tool provides warnings that indicate rule violations in managed code libraries. The warnings are organized into rule areas such as design, localization, performance, and security. Each warning signifies a violation of a Managed Code Analysis rule. This section provides in-depth discussions and examples for each Managed Code Analysis warning.

The following table shows the type of information that is provided for each warning.

Item Description
Type The TypeName for the rule.
CheckId The unique identifier for the rule. CheckId and Category are used for in-source suppression of a warning.
Category The category of the warning.
Breaking Change Whether the fix for a violation of the rule is a breaking change. Breaking change means that an assembly that has a dependency on the target that caused the violation will not recompile with the new fixed version or might fail at run time because of the change. When multiple fixes are available and at least one fix is a breaking change and one fix is not, both 'Breaking' and 'Non Breaking' are specified.
Cause The specific managed code that causes the rule to generate a warning.
Description Discusses the issues that are behind the warning.
How to Fix Violations Explains how to change the source code to satisfy the rule and prevent it from generating a warning.
When to Suppress Warnings Describes when it is safe to suppress a warning from the rule.
Example Code Examples that violate the rule and corrected examples that satisfy the rule.
Related Warnings Related warnings.

In This Section

Item Value
Warnings By CheckId Lists all warnings by CheckId
Cryptography Warnings Warnings that support safer libraries and applications through the correct use of cryptography.
Design Warnings Warnings that support correct library design as specified by the .NET Framework Design Guidelines.
Globalization Warnings Warnings that support world-ready libraries and applications.
Interoperability Warnings Warnings that support interaction with COM clients.
Maintainability Warnings Warnings that support library and application maintenance.
Mobility Warnings Warnings that support efficient power usage.
Naming Warnings Warnings that support adherence to the naming conventions of the .NET Framework Design Guidelines.
Performance Warnings Warnings that support high-performance libraries and applications.
Portability Warnings Warnings that support portability across different platforms.
Reliability Warnings Warnings that support library and application reliability, such as correct memory and thread usage.
Security Warnings Warnings that support safer libraries and applications.
Usage Warnings Warnings that support appropriate usage of the .NET Framework.
Code Analysis Policy Errors Errors that occur if the code analysis policy is not satisfied at check-in.