Code Connections for Visual Studio

Code Connections started out as a quick tool when I was frustrated trying to understand all the changes I was making as part of a side project. As happens sometimes, it quickly grabbed my full attention, rudely shouldered the first side project out of the way, and finally has reached the point that I’m comfortable making it publicly available.

You can get it here.

It’s an extension for Visual Studio for Windows, for C# developers. The basic idea is that if you have this:

Code Connections gives you this:

Graphing your dependencies

What Code Connections does is pretty simple. Internally it builds a ‘graph’, a connected network, of all the types in your solution. Then it takes a part of this graph and displays it to you.

By default, the visualised graph will show you the type (or types) in the file you’ve currently got open, as well as any types connected to it (its ‘dependencies’ and ‘dependents’, ie types it refers to, as well as types that refer to it). You can build any graph you want though by ‘pinning’ types to the graph.

Here you can see how it looks when you switch file tabs:

And here’s a graph I built quickly by choosing which types I wanted it to contain:

Git mode

The tool has a ‘Git mode’ built in. When enabled, it includes all types that have local changes in source control in the graph, handily marked by the type of change (new or modified).

Note that changes are quickly incorporated into the graph as you work, so newly-modified files and new dependency relationships will be automatically displayed.

Hierarchy and Compact layout modes

There’s two graph layout modes built in the tool, oriented to different strategies and purposes:

Hierarchy: maintain a strict vertical ordering, with dependencies above and dependents below, so you can see at a glance which are the ‘root’ dependencies.

Compact: blob everything together, for an efficient use of screen real-estate that lets you visualize a large number of elements at once.

Here’s how they look:

You can easily switch between them at any moment, depending on what you’re doing.

Filtering

Some times you want to exclude parts of your code from consideration. There’s extra options that allow you to:

  • filter out auto-generated types
  • filter out nested types
  • filter out specific projects in the solution

If you use the tool with a large solution and it’s taking a long time, you can try filtering out projects you’re less interested in (for example, unit test projects). This will speed up the process of building the graph, often significantly.


That’s Code Connections. You can download it here. It’s all open source – you can suss out the code here.

If you check it out, I’d love to know what you think, and if you find any bugs, do let me know.

Happy graphing!

Author: David Oliver

I’m a developer, ex-physicist, and occasional game designer. I’m interested in history, society, and the sciences of human behaviour, as well as technology and programming.

One thought on “Code Connections for Visual Studio”

Comments are closed.