Windows: Alt, V, M (press several times), Enter

Menu: View | Other Windows | Code Metrics Results

Command: View.CodeMetricsResults

SKU: Premium, Ultimate

Versions: 2008, 2010

Languages: C++ (managed only), C#, VB

Code: vstipTool0135


Having explored code metrics in great detail in the previous posts (see the article on Cyclomatic Complexity that started the series here: we can now turn our attention to the Code Metrics Results window. One of the first activities you will probably use it for is to calculate the code metrics for your solution:



Once metrics have been calculated there are several options available to you to work with the code metrics. Chief among the various actions is filtering. Using a filter, you can narrow down the metric you are interested in. For this example, I’ll choose Class Coupling:



Once I choose the metric to filter by then the Min and Max combo boxes are enabled so I can choose my filtering criteria:



Here is an example of some data before I apply a filter:



And after I apply a filter with a minimum of 3:



As you can see the members of DeliveryMethod have been reduced to show only those that match the current criteria. Also, whenever you apply criteria, the last ten filters (at the end of the list, indented) used are available in the Code Metrics window regardless of the project or solution:



When Visual Studio is closed the ten most recently used filter criteria are written to the registry at


WARNING: Make changes to the registry at your own risk.


A string value called MRUList is created that contains the filter information:



There isn’t any way to clear this list that I am aware of so occasionally I’ll just delete the MRUList value from the registry when I want the list to go away. Visual Studio will automatically create a new value once you start making new criteria.