Is there tool for .Net/C# to capture *run-time* dependencies between classes?
Asked Answered
S

4

8

What tool I can use for .Net/C# project to capture run-time dependencies between classes ? I found this question to be very useful but the suggested tools capture a static dependency graph. I simply want to see graph of instantiations of classes.

I'm using VS 2008 (but can install other version if needed).

UPD: My goal is this. I have huge old codebase. It has (for example) 500 classes but because DB-driven workflow has changed over the years only (for example) 100 class are used now. That's why static dependency analysis will be too overwhelming to digest.

Sverre answered 15/8, 2012 at 18:32 Comment(7)
Sounds like NDepend is right up your street...Anterior
@JonSkeet, I thought so too and I installed trial version. But it seems to be only does static analysis of dependencies where I'd like to get see dependencies in run-time. I have pretty old project which I need to analyze. So out of for example 300 classes maybe only 50 are being really used in run-time.Sverre
I voted to reopne this question. I don't understand why it was closed as not constructive. Other question I linked to didn't answer my question. That's why I clearly stated it.Sverre
@exacerbatedexpert, ehm, you're wrong, Sir. Maybe the question itself isn't that perfectly formed, but if you read it carefully, it's so obvious - how to monitor run-time dependencies of a .NET app. Where's a discussion?Etymon
I do not see how a static analyzer will be able to verify your run time dependencies. Static tools are quite limited. Let it run under a memory profiler and check which types were created. That would be the only way to be really sure.Gaily
@AloisKraus checking what types are created doesn't help for static classesWingfooted
No but it can give you a good indication which types are not used anymore when you execute typical use cases you still need to support. As with any tool you get only approximate results but this actually measured data is much more useful than seeing not dependency to a class in a static analysis tool. No analysis tools I am aware of does try to resolve run time dependencies of any DI framework. You need to be aware that dependencies are also configurable and whole type chains are hidden in your configuration files which are not accessible to code analysis tools anyway.Gaily
T
2

CLRProfiler can capture/display CallGraph: http://www.scribd.com/doc/3376247/CLRProfiler.

The file format is documented, so you can add your own analisys.

Teaspoon answered 25/8, 2012 at 3:34 Comment(0)
W
1

ANTS lets you visualize the call graph. Not precisely what you're looking for, but it might help. They have a 14 day trial and if you decide to buy it, it's well worth the money for profiling your .NET apps.

The .NET Memory Profiler lets you view instance graphs as well. A bit less spendy than ANTS and might do what you need to do.

Womb answered 15/8, 2012 at 23:8 Comment(0)
E
1

Not a call graph but a call list but IntelliTrace in VS can tell you the call history. If you filter for calls to constructors you probably can get most of the way there.

Effuse answered 25/8, 2012 at 0:43 Comment(0)
M
0

Doxygen is a free tool that can also generate call graphs along with some basic documentation.

Milkwort answered 16/8, 2012 at 7:23 Comment(3)
Interesting tool. But I don't see that it would help in this instance. The OP is looking for a tool to make the run-time dependencies as opposed to the static dependencies. Doesn't look like Doxygen will do this.Muntjac
According to the Doxygen feature list it can "generate include dependency graphs, collaboration diagrams, call graphs, directory structure graphs, and graphical class hierarchy graphs." Wouldn't a collaboration diagram assist with run-time dependencies? I'm pretty sure I generated something like that a few years back...Milkwort
To me it looks like a collaboration diagram will show what classes collaborate together (in terms of what classes the target class is dependent upon). It doesn't look like there is a way to run your code and have doxygen tell you only which execution paths occurred (which is what I think the OP is looking for). But if you know a specific configuration to do that, I'd make an edit to your answer and show how.Muntjac

© 2022 - 2024 — McMap. All rights reserved.