views:

2372

answers:

6

I just got a heaping pile of (mostly undocumented) C# code and I'd like to visualize it's structure before I dive in and start refactoring. I've done this in the past (in other languages) with tools that generate call graphs.

Can you recommend a good tool for facilitating the discovery of structure in C#?

UPDATE

In addition to the tools mentioned here I've seen (through the tubes) people say that .NET Reflector and CLR Profiler have this functionality. Any experience with these?

A: 

I'm not sure if it will do it over just source code, but ANTS Profiler will produce a call graph for a running application (may be more useful anyway).

Adam Robinson
+4  A: 

NDepend is pretty good at this. Additionally Visual Studio 2008 Team System has a bunch of features that allow you to keep track of cyclomatic complexity but its much more basic than NDepend. (Run code analysis)

Sam Saffron
NDepend feature set and screenshots (from website) look interesting. I'm going to check it out.
Waylon Flinn
+3  A: 

Visual Studio 2010.

Plus, on a method-by-method basis - Reflector (Analyzer (Ctrl+R); "Depends On" and "Used By")

Marc Gravell
Or outside reflector.. right click .. find all refrences, go to definition
Sam Saffron
will I have to convert my project to a new Visual Studio format? If so, how painless is this process?
Waylon Flinn
@Waylon Flinn: who knows... the product isn't released yet, or even in beta. However: with VS2005 to VS2008, project files were upgraded automatically and were (largely) backwards compatible; solution files were upgraded automatically, but were *not* backwards compatible.
Marc Gravell
Those things in .NET Reflector certainly are useful. I just wish there was a graphical version (or even an adjacency matrix). The add-in ' DependencyStructureMatrix' appears to come close but doesn't quite go all they way.
Waylon Flinn
Well thanks for the downvote, whoever that was. Care to qualify what you found so incorrect? Fact: VS2010 can generate call graphs...
Marc Gravell
A: 

SequenceViz and DependencyStructureMatrix for Reflector might help you out: http://www.codeplex.com/reflectoraddins

codekaizen
SequenceViz looks interesting but I can't get it to work with the newest version of .NET Reflector
Waylon Flinn
Finally got both of them to work. SequenceViz looks like it doesn't present present information in a way that's useful at the method level. DependencyStructureMatrix was useful but only appeared to give information at the Assembly and Class level. I'm looking for things on the Method level. Thanks for recommending these, they might be useful for something else.
Waylon Flinn
+2  A: 

I've used doxygen to some success. It's a little confusing, but free and it works.

C. Ross
The latest windows binary of Doxygen includes a GUI tool known as Doxywizard. You point this to the installation path of Graphviz which you install separately, and watch it build you graphs.
Jenko
I was using the Doxywizard. The part I found confusing is that it wouldn't use the C# settings (though it works fine with the Java settings). It's been several months since I tried to use it.
C. Ross
A: 

Concerning NDepend, it can produce some cool call graph like for example (image full size here)

alt text

Find more explanations about NDepend call graph here.

Patrick Smacchia - NDepend dev