Bagikan melalui


Troubleshooting Code Metrics Issues

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

  • Changes in Visual Studio 2010 code complexity calculations

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

Other Resources

Measuring Complexity and Maintainability of Managed Code