We recommend using Visual Studio 2017

Troubleshooting Code Metrics Issues


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Troubleshooting Code Metrics Issues.

You might encounter some of the following issues when you collect code metrics:

For the same function, the code complexity metric calculated in Visual Studio 2010 can be different from the metric calculated by earlier versions of Visual Studio for the following situations:

  • The function contains one or more catch blocks. In previous versions of Visual Studio, catch blocks were not included in the calculation. In Visual Studio 2010, the complexity of each catch block is added to the complexity of the function.

  • The function contains a switch (Select Case in VB) statement. Compiler differences between Visual Studio 2010 and earlier versions can generate different MSIL code for some switch statements that contain fall-through cases.

Measuring Complexity and Maintainability of Managed Code