Chapter 16
Analyzing Applications Using Architecture Explorer, Dependency Graphs, and Code Maps

What's in this chapter?

  • Exploring Architecture Explorer
  • Using Architecture Explorer to understand existing code
  • Visualizing existing code using dependency graphs
  • Visualizing existing code using code maps

Wrox.com Code Downloads for this Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/go/proalm3ed on the Download Code tab. The files are in the Chapter 16 download folder and individually named as shown throughout this chapter.

Every software developer has been in the following situation at some point in time: You have just started a new job with a new company, and you're expecting to write a new, fancy application. You are up to speed on some of the latest coding technologies, methodologies, and languages. You arrive for work ready to sit down and use everything you know to crank out some code to help the company succeed.

And then it happens. There is a legacy system that was built several years ago that must be updated. You are the lucky developer who has been assigned to make that update — never mind that you have no idea or concept of how the application works, the inner workings of the calls between different objects, or how it interacts with other third-party add-ins.

Before Visual Studio Ultimate 2010, the only solution to this problem was to get your hands dirty in the code. You had to open the code files and start tracing (as best you could) how the logic flows between the different classes and components that make up the application. Maybe you would even try (as best you could) to diagram the logic flow on a piece of scratch paper.

Visual Studio Ultimate 2010 changed all that with the introduction of the Architecture Explorer tool, and Visual Studio Ultimate 2013 has added even more functionality to make exploring your application easier. Using Architecture Explorer, you can quickly learn more about your current application by visualizing the organization and relationships among the various parts. By using Architecture Explorer in conjunction with dependency graphs, you can analyze an existing system and more quickly understand it. Code maps, new to Visual Studio Ultimate 2013, provide another visualization option for your code. These tools also enable you to find areas in the application that should be improved or modified.

This chapter examines Architecture Explorer, dependency graphs, and code maps. The chapter begins with a discussion about the Architecture Explorer tool, including what it is, and how it was designed to be used. From there, you learn about using Architecture Explorer and how you can use it to drill down into your existing application.

After that, you learn how to take the information from Architecture Explorer and make it graphical by turning it into a dependency diagram. Dependency diagrams are a nice way to graphically view your code, as well as code contained in other managed DLLs (such as the .NET Framework). In Visual Studio Ultimate 2013, dependency graphs can visualize code without the use of Architecture Explorer. In this chapter, you find out how to utilize those features and learn about the Code Index, a back-end database for dependency graphs that helps speed the visualization process. You'll also learn about code maps, and how you can use them to understand your project code.

Understanding the Code Base

Although the example used throughout this chapter is rather simplistic, it works well to introduce the different capabilities of Architecture Explorer, dependency diagrams, and code maps. So, let's take a look at the code base used throughout this chapter so that later sections will make more sense.

Figure 16.1 shows the projects and code files that make up the sample solution.

image

Figure 16.1

This solution is made up of two project files:

  • FirstProject—This project contains two class files, FirstClass.cs and SecondClass.cs. The FirstClass.cs class file contains two methods, Method1 and Method2. The SecondClass.cs class file contains one method, Method3.
  • SecondProject—This project contains one class file, ThirdClass.cs. The ThirdClass.cs class file contains three methods: Method4, Method5, and Method6.

Getting confused yet? Let's add to it a little more:

  • Method1 calls Method3 and Method2.
  • Method2 calls Method1.
  • Method3 doesn't call any other methods.
  • Method4 calls Method1.
  • Method5 calls Method3.
  • Method6 doesn't call any other methods.

Whew! All of that sounds just a little bit confusing, and this is only a contrived solution with two projects and three classes. Imagine what it would seem like with a real software solution, with hundreds of projects, and thousands of classes and methods. As you are about to learn, though, Architecture Explorer, dependency graphs, and code maps are going to help with the understanding of any project, both small and large.

Architecture Explorer Basics

In Visual Studio Ultimate 2013, you use Architecture Explorer to drill down into your existing code, which enables you to select the code you want to visualize using a dependency graph. You can use Architecture Explorer to browse existing source code open in Visual Studio Ultimate 2013, as well as browse compiled managed code located in .dll or .exe files. You can extend Architecture Explorer with third-party tools, which allow you to browse other domains of code or other items. After you have drilled down into your code and selected the items you are interested in, you can turn that information into a dependency graph.

Understanding the Architecture Explorer Window

To open Architecture Explorer, open Visual Studio Ultimate 2013. From the main menu of Visual Studio, select View⇒Architecture Explorer. Alternatively, from the main menu of Visual Studio, you can select Architecture⇒Windows⇒Architecture Explorer.

Figure 16.2 shows an initial view of Architecture Explorer.

image

Figure 16.2

Architecture Explorer represents structures as nodes and relationships as links. As you browse through your code base using Architecture Explorer, nodes are displayed in successive columns to the right. The first column in Figure 16.2 shows the initial domains and views that are available for browsing. Selecting a domain or view causes a new node to appear to the right with the results of that selection.

When you select a node in a column, the next column shows node information that is logically related to the selection made in the initial column. For example, selecting a class in a column shows the members of that class in the following column. You have the capability to select multiple nodes in multiple columns and then display that information as a dependency graph.

Architecture Explorer Options

As you can see in Figure 16.2, there are four options (represented as icons) available on the left side of the Architecture Explorer window.

The first option enables you to create a new dependency graph document from all the nodes currently selected in Architecture Explorer. To include only the nodes in the current column, you can press and hold the Ctrl key before clicking this option.

The second option enables you to add the selected nodes from Architecture Explorer to an existing dependency graph that is currently visible in Visual Studio. As with the first option, to include only the nodes that are in the current column, press and hold the Ctrl key before clicking this option.

The third option enables you to export the information from Architecture Explorer into a .dgml file. A Directed Graph Markup Language (DGML) file is the XML schema used to define a dependency graph. Selecting this option exports all the information open, in all of the columns, into a .dgml file that you can view at a later date.

The fourth option resets Architecture Explorer to its initial state, cleaning up the window and enabling you to start from the beginning.

Navigating Through Architecture Explorer

To begin navigating through Architecture Explorer, select one of the rows in the first column. You have several options.

Under the Visual Studio column heading you can choose to view the information in your solution either by classes or through a solution view, which enables you to view the different files in your solution. If you don't want to drill down through all the files in a solution, you can click the Select Files option and open only the files you are interested in.

For this example, let's navigate through the code using the Class View options. In Architecture Explorer, select Class View under Visual Studio <My Solution>. This opens a new column to the right of the selected column, displaying a list of all the different namespaces in the solution, as shown in Figure 16.3.

image

Figure 16.3

In Figure 16.3, you see that the two namespaces currently in the solution (FirstProject and SecondProject) are displayed on the right of the screen.

Obviously, for a large project, you could have many namespaces, which could result in a large scrolling list in this column. The listbox at the top of the column enables you to filter the information in this column. For example, if you only wanted to see namespaces that began with “Second” you could type Second in the listbox, press Enter, and the contents of the column would be filtered, as shown in Figure 16.4.

image

Figure 16.4

Notice the differences between Figure 16.3 and Figure 16.4. Figure 16.3 displays all the namespaces in the solution. Figure 16.4 displays only the namespaces that match the filter expression. Also, notice the filter icon that is added in the lower-right of the column, giving a visual indication that the column is currently being filtered.

To clear the filtering on a column, simply delete the filter statement and press Enter. This removes the filter and displays the entire contents of the column.

From the namespace column, you can navigate into the different classes contained in a particular namespace. Selecting the FirstProject namespace opens a new column to the right, containing the classes in the FirstProject namespace — in this case, FirstClass and SecondClass. As mentioned previously, you can filter on this column by entering your filter criteria into the listbox at the top of the column. You can also filter based on different categories and properties.

Click the filter button located to the left of the filter listbox at the top of the column. This displays all the possible categories and properties that can be filtered on, as shown in Figure 16.5.

image

Figure 16.5

For this particular column on classes, you have the following filter options:

  • Class
  • Is Abstract
  • Is Final
  • Is Public
  • Icon

You have the option of selecting one or multiple filter options, allowing you to drill down into the information contained in the column in a variety of ways.

Exploring Options for Namespaces

In addition to the filtering options mentioned previously, you have another option for controlling what is displayed in a column. In Figure 16.5, just to the left of the column containing the classes, there is a collapsed column labeled Types. Clicking that collapsed column expands it, as shown in Figure 16.6.

image

Figure 16.6

This column provides a variety of options for determining what is initially displayed in the column. The first section is the Node Navigation section. By default, the Types node is selected, which shows all the different available types — in this case, FirstClass and SecondClass. You can select the following nodes for display:

  • Classes
  • Delegates
  • Enums
  • Interfaces
  • Members
  • Modules
  • Namespaces
  • Structs
  • Typedefs
  • Types
  • Unions
  • Aliases

You can select multiple nodes by holding down the Ctrl key while you select the nodes. Each time you select a node, the column to the right recalculates with the new data to display.

You have the capability to organize the link types into two categories: outbound and inbound. These categories describe the direction of the link in relation to the currently selected node.

An outbound link points from the currently selected node to the next related node. For example, say that you have currently selected the FirstProject namespace. If you select All Outbound under Outbound Navigation, the two classes, FirstClass and SecondClass, are displayed. FirstClass and SecondClass exist in the FirstProject namespace, and, as such, are the next related nodes beneath the FirstProject namespace.

You have the following options for Outbound Navigation:

  • All Outbound
  • Contains

An inbound link points from a previously related node to the currently selected node. For example, say that you have currently selected the FirstProject namespace. If you select All Inbound under Inbound Navigation, the solution file MySolution is displayed in the next column. MySolution exists above the FirstProject namespace from a hierarchical perspective.

The following options exist for Inbound Navigation:

  • All Inbound
  • Contained By
  • Namespace Reference Source

You also have the capability to perform Analysis and Grouping options. Using the Analysis options, you can look for circular references or hubs (for example, classes) that are not being called or used. The Grouping options also enable you to group by container or properties.

The following options exist for Analysis:

  • Circular References
  • Find Hubs
  • Unreferenced Nodes

The following options exist for Grouping:

  • Group by Containers
  • Group by Properties

Exploring Options for Classes

Previously, you learned about some of the Node Navigation options from a namespace perspective. Let's continue the example by selecting the FirstClass class in Architecture Explorer to see what Node Navigation options are from a class perspective. Figure 16.7 shows Architecture Explorer after the FirstClass class has been selected.

image

Figure 16.7

By default, Node Navigation defaults to Members. As you can see in Figure 16.7, FirstClass has only two members: two methods named Method1 and Method2. As you might expect, the filtering options at the top of the column work the same as they have in previous columns. However, now that you are working on a class level as opposed to a namespace level, you have different navigation options.

From the Node Navigation options, you can view any of the following information about the selected class:

  • Classes
  • Delegates
  • Enums
  • Generic Arguments
  • Generic Parameters
  • Interfaces
  • Members
  • Structs
  • Types

Outbound Navigation has several more options available to it, as you would expect. Classes can inherit from other classes, implement interfaces, and have attributes. The following are the Outbound Navigation options:

  • All Outbound
  • Contains
  • Generic Arguments
  • Generic Parameters
  • Implements
  • Inherits From
  • Uses Attribute

Inbound Navigation also has more options, including the following:

  • All Inbound
  • Contained By
  • Inherited By
  • Used By

The Analysis patterns and Grouping options are the same as before.

Exploring Options for Members

For this example, drill down one more level to look at some of the Node Navigation options available at a member level. In Architecture Explorer, select the Method1 method, as shown in Figure 16.8.

image

Figure 16.8

As you would expect, the Node Navigation options have changed again. By default, when you select a method, the resulting column in Architecture Explorer shows all the outbound calls that method makes (that is, all the methods that the selected method uses).

From a Node Navigation perspective, you can view any of the following information about the selected method:

  • Block Expressions
  • Classes
  • Fields
  • Generic Arguments
  • Generic Parameters
  • Methods
  • Parameters
  • Types

Outbound Navigation has several more options available to it, as you would expect. The following are the Outbound Navigation options:

  • All Outbound
  • Calls
  • Contains
  • Function Pointers
  • Generic Arguments
  • Generic Parameters
  • Parameters
  • Reads Fields
  • Return Types
  • Uses Attribute
  • Writes Fields

Inbound Navigation also has more options, including the following:

  • All Inbound
  • Called By
  • Contained By
  • Function Pointers
  • Property Gets
  • Property Sets
  • Referenced By

The Analysis patterns and Grouping options are the same as before.

Dependency Graphs

They say a picture is worth a thousand words, and dependency graphs prove that saying. Architecture Explorer is invaluable for its capability to drill down into the code base, but it can also present so much information that it can be a bit overwhelming as well. Given its capability to continuously scroll to the right, you could become confused after doing an intense, deep drill-down. Wouldn't it be nice to be able to visualize the information from Architecture Explorer? Dependency graphs enable you to do just that.

You can use a dependency graph to explore the relationships and organization of an existing code base. These graphs make it easy to understand code that is new or unfamiliar to you. The relationships on the graph make it readily apparent how different areas of code relate to one another and can show you how a change to one area of code could cause potential issues for other areas of the code. You have multiple ways to view your dependency graph information.

Creating the First Dependency Graph

You actually have several different options for creating a dependency graph. Because the first half of this chapter deals with Architecture Explorer, let's continue that thread so you can see how you can create dependency graphs from Architecture Explorer. Later, you learn how you can create dependency graphs, without using Architecture Explorer, to get a quick overview of your source code or compiled code.

Previously, using Architecture Explorer, you learned how to drill down into your source code. You saw how to select the FirstProject namespace, the FirstClass class, and the Method1 method. From here, let's select Method2 and Method3 in Architecture Explorer.

To display this information as a dependency graph, simply click the Create a New Graph Document button on the Architecture Explorer window. This takes all the information selected in Architecture Explorer and displays it as a dependency graph, as shown in Figure 16.9.

image

Figure 16.9

As you can see, this graph provides an easy-to-understand graphical overview of the information contained in Architecture Explorer. You can see that the FirstProject namespace contains the FirstClass class. The FirstClass class contains two methods: Method1 and Method2. Method1 makes references to both Method2 and Method3. Also, you can see that Method2 makes reference to Method1.

If you want to view the code file for a particular node, that is easy to do from the dependency graph. You simply right-click the node and select Go To Definition from the context menu to open the code file associated with the selected node.

You can easily add more nodes to an existing dependency graph. Let's say you create an initial dependency graph using Architecture Explorer. Now, let's say that you want to add more nodes to the graph to make it more detailed. Select the nodes you want to add in Architecture Explorer and then click the Add Selected Nodes to Existing Graph button on the left side of the Architecture Explorer window. This adds the selected nodes to the existing graph.

Creating a Dependency Graph Without Architecture Explorer

You can also create a dependency graph without even opening Architecture Explorer. This can be very handy when you want to analyze the entire code base of your code without having to worry about drilling down through particular elements using Architecture Explorer. For example, you can drag and drop a .NET assembly onto a blank diagram and it automatically decomposes the assembly for you.

From the main menu of Visual Studio Ultimate 2013, select Architecture⇒Generate Dependency Graph. This provides you with two options for generating your dependency graph:

  • For Solution—This option generates a dependency graph based on the current open solution.
  • For Include File—This option generates a dependency graph based on a C++ include file.

Figure 16.10 shows an example of a dependency graph generated using the For Solution option. You will need to click Legend to see the legend shown in Figure 16.10.

image

Figure 16.10

Each project generates its own assemblies, which, in the example project, would be FirstProject.exe and SecondProject.exe. In addition, there is a reference to an Externals assembly, which includes the references and calls into the .NET Framework. Although the black-and-white picture might not show it well, the legend is color-coded to help you easily understand the different aspects of your dependency graph.

Navigating Through Your Dependency Graph

You may be thinking that the information shown in Figure 16.10 is nice, but it is not that helpful. It sure would be nice if you could drill down into the dependency graph in a manner similar to how you drill down into information in Architecture Explorer. Well, guess what? You can!

By clicking the arrow icon located at the top-left of a node, you can expand the node to view the detailed information in that node, as shown in Figure 16.11. The arrow icon will become visible when you mouse over the node.

image

Figure 16.11

FirstProject.exe is comprised of the FirstProject namespace. The namespace contains three classes: FirstClass, SecondClass, and Class1. FirstClass contains two methods: Method1 and Method2. SecondClass contains one method: Method3.

The dependency graph shows the interactions between the different methods. It also shows that the SecondProject.exe assembly makes calls to Method3 in the SecondClass class. To view exactly which object is making this call, you can expand the information for that assembly on the dependency graph.

The next question you might have is whether you can drill down into that external node. The answer is, yes! Using a dependency graph, you can drill down into external assemblies (such as the .NET Framework). This is an incredibly powerful tool. You now have the capability to delve into the .NET Framework and map how all the objects and methods interact with each other, enabling you to come to a much better and deeper understanding of how the .NET Framework works. Figure 16.12 shows an example of this.

image

Figure 16.12

You also have the capability to interact with your dependency graph by right-clicking the graph and selecting from a variety of context menu options. You will recognize many of the options from Architecture Explorer. The exact options depend on what is selected on the dependency graph.

You can select a specific node on a graph and then choose the Advanced⇒Select menu option from the context menu. This enables you to do the following:

  • Select all incoming links to the selected node
  • Select all outgoing links from the selected node
  • Select both incoming and outgoing links from the selected node
  • Select all connected nodes to the selected node
  • Select all children of the selected node

You have the capability to add groups and categories to the graph, enabling you to organize the graph in a more readable fashion.

Refer to Figure 16.11 to see another nice feature of dependency graphs, which is the capability to apply different analyzers to the information on the graph. You saw these analyzers before when you worked with Architecture Explorer, but they make even more sense when you see them in conjunction with the dependency graph.

From the Legend, click the Add button (it looks like a plus sign), select Analyzer, and then select Circular References. This analyzer looks for circular references, or infinite loops, in your graph. When those references are found, it highlights them (in red) on the dependency graph, instantly bringing them to your attention, as shown in Figure 16.13.

image

Figure 16.13

The Find Hubs analyzer is also available. It shows which hubs are a Node Property in the top 25 percent of high-connected nodes. This is a quick-and-easy way to see which hubs are involved with a majority of the work in the application.

The Unreferenced Nodes analyzer is also available. It highlights any nodes that are not referenced by any other nodes. They are orphans. This is a good way to find areas of the code that are not being used either because of oversight or because they are no longer needed.

Dependency Graph Legend

In the upper-right corner of each dependency graph is the legend (see Figure 16.11). You can use the legend to help you understand all the different components that make up the dependency graph. One nice feature of the legend is that it is completely customizable, which means you can control the shapes and colors that are used on the graph, thus enabling you to customize the graph to your needs.

For the dependency graph shown in Figure 16.11, if you were to click the Add button on the legend (the plus icon), you would have the following four options that could be added to the graph:

  • Node Property
  • Node Category
  • Link Property
  • Link Category

Each of these options has sub-options underneath it that you can add to the legend. To see these sub-options, you will need to expand the nodes in the diagram. For Node Property, the options are the following:

  • Is Abstract
  • Is Final
  • Is Private
  • Is Public
  • Is Static
  • StrongName
  • Error
  • File Path
  • Group
  • Circular References

For Node Category, the options are the following:

  • Assembly
  • Class
  • Method
  • Namespace
  • Externals
  • FileSystem.Category.FileOfType.exe

For Link Property, the options are the following:

  • Circular Link
  • Weight

And, finally, for Link Category, the option is the following:

  • Calls
  • User Attribute
  • Inherits From
  • References

When you have added a new item to the legend, you can customize its appearance. You can click the icon in the legend and select from the following four customization options:

  • Background—This lets you select a color for the background of the node.
  • Stroke—This selects the color that outlines the node.
  • Foreground—This sets the text color in the node.
  • Icons—This enables you to select from a variety of icons to add into the node itself.

Dependency Graph Toolbar

You can use the dependency graph toolbar to modify the look and feel of a dependency graph. At the far left of the toolbar are the Undo/Redo buttons, allowing you to undo a change or reapply a previously undone change. The Show Related drop-down allows you to see any assemblies that reference, or are referenced, by a selected item on the graph. The Layout drop-down allows you to specify the directional flow of the dependency graph. Options here include Left-to-Right, Right-to-Left, Top-to-Bottom, Bottom-to-Top, and Quick Clusters. Top-to-Bottom is the default view. The Quick Clusters view shows the nodes as clusters or hubs. In this view, the graph is arranged with the most dependent nodes near the center, and the least dependent nodes at the outer edges of the clusters of hubs. Figure 16.14 shows the dependency graph toolbar.

image

Figure 16.14

Clicking the magnifying glass opens a search window, so you can search the dependency graph for specific information. The Share drop-down allows you to copy the dependency graph image to the clipboard, email the image, or save it as a portable XPS document.

Finally, there are the zoom controls. As you can imagine, a dependency graph can grow to be quite large. These tools enable you to zoom into and out of areas of the graph that you are interested in. You can use the drop-down listbox to fit the graph to the page or to select pre-specified zoom options. You can also use the scroll wheel on the mouse to zoom in and out of the graph, as well as a button to fit the diagram to the screen.

The Code Index

One of the things you will notice about dependency graphs is that they are very responsive. When you generated a dependency graph for the entire solution, you probably saw the window in Figure 16.15.

image

Figure 16.15

When you generate a dependency graph, the first thing that happens is the solution is built. Next, the assemblies are indexed and stored in a SQL Server localdb database. This database is referred to as the Code Index. Then, the graph is built using the indexed information from the Code Index. Although this means the initial visualization of the graph takes longer to generate, after you start working with the graph you can very quickly drill down into elements or add new elements to the graph.

Zooming in and out of a dependency graph is a fast, pleasant experience. In Visual Studio Ultimate 2013, through the use of the Code Index, only the portion of the graph that is being utilized at the time is brought into memory, making it much more responsive.

As just mentioned, the Code Index is created when the dependency graph is initially generated. It is possible to prepopulate the index during the automated build process, using build tasks. To do this, you need to make use of the Visual Studio Visualization and Modeling SDK, which is freely available from Microsoft.

You can view the contents of the Code Index using Server Explorer in Visual Studio Ultimate 2013. Open the Server Explorer window in Visual Studio Ultimate 2013. Right-click the Data Connections icon and select Add Connection from the context menu. This opens the Choose Data Source window. Select Microsoft SQL Server, then click the Continue button. This opens the Add Connection window, shown in Figure 16.16.

image

Figure 16.16

In the Server Name field, enter (localdb)v11.0. Select the database named Repository. This is the Code Index database. Click OK to close the window and connect to the Code Index. Figure 16.17 shows a list of tables from the Code Index. At this point, you can open the tables to view the data collected by the indexing.

image

Figure 16.17

Code Maps

Code maps are a new feature in Visual Studio Ultimate 2013 that, in some ways, are very similar to dependency graphs. Code maps allow you to visualize your code relationships. However, one of the main differences is that code maps appear alongside your code, allowing you to see where you are in the hierarchy of the code while you are working on the code itself.

In Visual Studio, in your current working solution, open the FirstClass.cs file. Right-click Method1 and select Show on Code Map from the context menu. This opens a new tab, named CodeMap1.dgml, next to your code, and adds a single node for Method1, as shown in Figure 16.18.

image

Figure 16.18

The green arrow next to the node indicates that your cursor is currently in this method. In Visual Studio you can select Method2 to see the cursor disappear on the code map. Select the Method1 node on the code map, and look at the code window. Notice that all the places where the method is called are highlighted in the code file. This makes it easy to find all instances of a called object within a section of code.

Let's take this one step farther, and say you want to find all the methods that call Method1. You can right-click Method1 in the code map, and select Find All References. You can also right-click Method1 in your code, and select Find All References on Code Map. This will find all the references to Method1 in your code base, and add them to the code map, shown in Figure 16.19.

image

Figure 16.19

The latest nodes added to the map are shown in green, making it easy to find them. As you can imagine, code maps can grow rather large. You can use the toolbar at the top of the code map tab (the same toolbar used for dependency graphs) to resize the diagram as well as change its orientation. You can also right-click a node to change its colors. You can add comments to a code map by right-clicking the code map and selecting New Comment from the context menu. This allows you to provide annotations that other team members might find helpful.

Each item in the code map has a recycle icon located in its top-left corner. This is the Refetch Children button. Clicking this button will fetch any children of the associated item, and add them to the code map.

Another nice feature of code maps is its ability to view the call stack visually while debugging. This also allows you to make notes on the map to track what the code is doing, while you are trying to find and fix bugs. You can create code maps in C#, Visual Basic, C++, and JavaScript. To try this out, open the FirstClass.cs file in Visual Studio, and set a breakpoint on the SecondClass.Method3(); line. Press F5 to start debugging the application. Visual Studio will break at the selected line, and enter debug mode. In the debugger toolbar at the top of Visual Studio, select the Code Map button, shown in Figure 16.20.

image

Figure 16.20

This opens the current call stack (shown in orange) in a code map window next to the code base. Now what's nice about this code map is that it will be automatically updated as you move through your code. Figure 16.21 shows the code map after stepping through the code.

image

Figure 16.21

Notice how the code map shows where the breakpoints have been set in your code. The yellow arrow shows your current location in the code, while the squares above it show how you arrived in your current position. Not all calls will appear in the code map. By default, only the code you created will appear. To see external code, turn it on in the Call Stack window or turn off Enable Just My Code in the Visual Studio debugging options. When you are done debugging, the code map will be preserved. This allows you to save it if desired and keep a map of the debugging experience. You can then save the code map as an XPS file or send it to your teammates as an email.

Summary

This chapter examined Architecture Explorer, dependency graphs, and code maps. The chapter started off discussing Architecture Explorer, including why you would want to use it, and how to use it. From there, you walked through an example of using Architecture Explorer so you could become familiar with many of its features.

The discussion then moved on to dependency graphs. You learned how dependency graphs can be created with information from Architecture Explorer, as well as directly from solutions. You also learned about dependency graphs in depth and how to use all the options available. You also learned how the Code Index speeds the performance of dependency graphs. Finally, you learned about code maps and how they can be used as part of the debugging process.

Chapter 17 is the final chapter on the architecture tools available in Visual Studio Ultimate 2013. Chapter 17 looks at layer diagrams, how they are built, and how they are useful in dividing your code base into understandable sections, as well as how they can be used as a validation tool during the build process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset