Find potential problems using code map analyzers

 

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 Find potential problems using code map analyzers.

Run analyzers on code maps to help you identify code that might be overly complex or that might need improvement. For example, you can use these analyzers:

To find code that hasExamine these areas to see whether
Loops or circular dependenciesYou can simplify them and consider whether you can break these cycles.
Too many dependenciesThey are performing too many functions or to determine the impact of changing these areas. A well-formed code map will show a minimal number of dependencies. To make code easier to maintain, change, test, and reuse, consider whether you can refactor these areas so that they are more clearly defined, or whether you can merge code that performs similar functions.
No dependenciesThey are necessary or whether you should remove this code.
  1. On the map toolbar, choose Layout, Analyzers, and then analyzer that you want to run:

    AnalyzerTo identify nodes that
    Circular References AnalyzerHave circular dependencies on each other. Note: Circular dependencies that are in the Generics group are not shown on the map when you expand the group.
    Find Hubs AnalyzerAre in the top 25% of highly-connected nodes

     To hide all other nodes on the map

    - Open the shortcut menu for the map, choose Advanced, Select, Hide Unselected.
    The map hides the unselected nodes, and the analyzer identifies new nodes as hubs.
    Unreferenced Nodes AnalyzerDo not have references from any other nodes. Caution: Verify each of these cases before assuming that the code is not used. Certain dependencies such as XAML dependencies and run-time dependencies cannot be found statically in the code.

Code map analyzers will continue to run after you apply them. If you change the map, any applied analyzers will automatically reprocess the updated map. To stop running an analyzer, on the map toolbar, choose Layout, Analyzers. Turn off the selected analyzer.

System_CAPS_ICON_tip.jpg Tip

If you have a very large map, running an analyzer might cause an out of memory exception. If this occurs, edit the map to reduce its scope or generate a smaller one, and then run the analyzer.

Map dependencies across your solutions
Use code maps to debug your applications
Map methods on the call stack while debugging

Show: