Troubleshooting Code Metrics Issues


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

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

Changes in Visual Studio 2010 code complexity calculations

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.

See also