1

How to view stack trace of project in debug mode in VS 2008?

I am running and debugging a big application in VS2008. Build mode is DEBUG, Windows Forms project. Is there a way I can see the pieces of codes getting called, something like Stack Trace in exception while i do normal actions in the form like clicking button, etc...

The project is so big I need to easily find the form being called on each nodes on the tree. It would be very helpful if I can see the something like Call Stack Trace. Call Stack is not working like this btw.

Thanks.

BIBD
  • 15,107
  • 25
  • 85
  • 137
  • 1
    I don't understand. Why couldn't you just set a breakpoint on the button click handler? – wj32 Jan 11 '10 at 10:41
  • @Rodel, Regarding: "Call Stack is not working like this" Do you mean that when you run your application, the Call stack is empty unless you hit a breakpoint? You would really like to see the Call Stack updated continually as your application runs, based on where the current code location? – Ash Jan 11 '10 at 11:38

2 Answers2

5

Menu: Debug, Windows, Call Stack.

But you say "it is not working", could you elaborate a little?

H H
  • 263,252
  • 30
  • 330
  • 514
  • I think the OP is asking about being able to view a call stack as the program is actually running. I could be wong but I believe you have to break into your program for the VS Call stack to be populated (ie it is not updated dynamically). – Ash Jan 11 '10 at 10:56
  • Ash, a 'real-time' call stack would slow down a program enormously and be too fast to read at the same time. – H H Jan 11 '10 at 11:20
  • Henk, maybe, but I believe that is what the OP means by "it is not working". – Ash Jan 11 '10 at 11:33
1

Sounds like you want some sort of static or dynamic program analysis tool. Here is a good list of some of the more popular tools available for .NET.

Dynamic analysis programs allow you to run the the program and record the class construction and call hierarchy of your application on the fly, for later review.

Static analysis programs require you to point the program at your source code and then build a similar but possibly more exhaustive analysis of your call hierarchy.

See also: What static analysis tools are available for c#

Community
  • 1
  • 1
Ash
  • 60,973
  • 31
  • 151
  • 169
  • Sorry for all the confusion but your answer is very close to what i want to achieve. A tool for dynamic analysis where i can see each code being execute as i do all he UI interactions in the winform application. – Rodel Dagumampan Jan 28 '10 at 03:25
  • Why do i need this? A big application is handed over to my team and for start we need to study it, upto the code level. Of course we have no idea where things are placed. Breakpoints works only if you know where to put break breakpoints. But in the case where you have no idea what forms in the hundreds of forms and classes in several solutions is loaded, it will be easy like seeing what gets executed for every click. – Rodel Dagumampan Jan 28 '10 at 03:25
  • @Rodel, Yes, code analysis tools are very useful when you are dumped with a large application with no/little documentation. It makes no difference whether it is a Windows Forms application, WPF, etc. You also learn where the program spends most of it's time, which also indicates more complex or possibly poorly designed code. Good luck. – Ash Jan 28 '10 at 04:37
  • What application is capable of this behaviour? "Dynamic analysis programs allow you to run the the program and record the class construction and call hierarchy of your application on the fly, for later review." – Rodel Dagumampan Jan 28 '10 at 04:55
  • NDepend, Visual Studio Team Edition Profiler and many others. The choicedepends how much and what sort of dynamic information you are looking for. – Ash Jan 28 '10 at 05:29