11

Is there some kind of an application that analyzes source code and graphically shows all the connections between function?

I need it for a legacy code I'm working on - It's huge , functional and badly written... :(

Yossale
  • 14,165
  • 22
  • 82
  • 109
  • 1
    Can you switch to visual studio 2010? Then just use the build in tools in that – Rune FS Aug 29 '10 at 08:08
  • @Rune FS: +1. I consider this a legitimate answer. Not sure if others would agree w/ me or not. You may want to mention where to find those tools in VS. – Merlyn Morgan-Graham Aug 29 '10 at 08:12
  • 1
    possible duplicate of [C# Call Graph Generation Tool](http://stackoverflow.com/questions/793685/c-call-graph-generation-tool) – Timwi Aug 29 '10 at 08:16

5 Answers5

7

NDepend do exactly that and more other things (code metrics...)

Julien Hoarau
  • 48,964
  • 20
  • 128
  • 117
4

In Visual Studio 2010 Ultimate you can Generate Sequence Diagrams:

http://www.devcurry.com/2010/03/generate-sequence-diagrams-in-visual.html

You can also check MSDN documentation for details:

http://msdn.microsoft.com/en-us/library/dd409458.aspx

And this might be of interest too (Generate Dependency Graphs for .NET Code):

http://msdn.microsoft.com/en-us/library/dd409453.aspx

Yakimych
  • 17,612
  • 7
  • 52
  • 69
2

NDepend can manage calling graph well indeed as suggested madgnome. Let me develop a bit. First you can ask for the call Graph with a CQL query, second you can export the query result to the Dependency Graph or Dependency Matrix.

Concretely, below we ask for methods' callers of the class AppDomain in NUnit 2.4.8 (it could be a method, a field, a namespace ... whatever). This menu could appear also in Visual Studio thanks to the NDepend VS addin.

alt text

Then a CQL query is generated for us, we can see that 30 methods are matched in the calling graph. We have the option to export hese set of methods o a graphical graph...

alt text

...and here is the outputed graph (see a large version picture of this graph here)

alt text

Patrick from NDepend team
  • 13,237
  • 6
  • 61
  • 92
0

.Net Reflector is pretty neat - I've used it a couple of times for getting this sort of information. There are a number of addins, at least one of which generates dependency diagrams.

Also, in VS.Net 2008 or higher, right-click 'Find All References' can be useful.

Will A
  • 24,780
  • 5
  • 50
  • 61
0

ReSharper provides features that allow you to see graph of methods, that are calling your method and vice verse. (Outgoing and Incoming calls)

This is new feature called "Call Tracking"

Andriy Buday
  • 1,959
  • 1
  • 17
  • 40