Code Analysis for Managed Code Warnings

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

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.

ItemDescription
TypeThe TypeName for the rule.
CheckIdThe unique identifier for the rule. CheckId and Category are used for in-source suppression of a warning.
CategoryThe category of the warning.
Breaking ChangeWhether 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.
CauseThe specific managed code that causes the rule to generate a warning.
DescriptionDiscusses the issues that are behind the warning.
How to Fix ViolationsExplains how to change the source code to satisfy the rule and prevent it from generating a warning.
When to Suppress WarningsDescribes when it is safe to suppress a warning from the rule.
Example CodeExamples that violate the rule and corrected examples that satisfy the rule.
Related WarningsRelated warnings.
Warnings By CheckIdLists all warnings by CheckId
Cryptography WarningsWarnings that support safer libraries and applications through the correct use of cryptography.
Design WarningsWarnings that support correct library design as specified by the .NET Framework Design Guidelines.
Globalization WarningsWarnings that support world-ready libraries and applications.
Interoperability WarningsWarnings that support interaction with COM clients.
Maintainability WarningsWarnings that support library and application maintenance.
Mobility WarningsWarnings that support efficient power usage.
Naming WarningsWarnings that support adherence to the naming conventions of the .NET Framework Design Guidelines.
Performance WarningsWarnings that support high-performance libraries and applications.
Portability WarningsWarnings that support portability across different platforms.
Reliability WarningsWarnings that support library and application reliability, such as correct memory and thread usage.
Security WarningsWarnings that support safer libraries and applications.
Usage WarningsWarnings that support appropriate usage of the .NET Framework.
Code Analysis Policy ErrorsErrors that occur if the code analysis policy is not satisfied at check-in.
Show: