Solved

How do I view the code execution path in visual studio debugger (Maybe the stack trace)

Posted on 2014-10-22
4
597 Views
Last Modified: 2014-10-23
Hello, I am tracing through a huge C# code file using the VIsual Studio 2010 debugger. The file has huge methods and many "if then" statements.
Is their a way to view a list of the line numbers of the code that has been previously executed up to the point where my trace point is in the compiler? I need to know how to do that.
0
Comment
Question by:brgdotnet
  • 2
4 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 230 total points
Comment Utility
Hi brgdotnet;

Using InteliTrace, "starting with Visual Studio 2010 Ultimate" please see this link Debugging Applications with IntelliTrace.

You can also use the Call Stack which will also give the information, How to: Use the Call Stack Window.
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 270 total points
Comment Utility
Visual Studio Ultimate is expensive, and the Call Stack list the method calls, not the individual lines.

The easiest way I know of with one of the regular versions of Visual Studio is to put pertinent Debug.WriteLine calls in your code. These instructions send the information you pass as a parameter to the Output window. You can leave them in your code, by default they have no impact on the release version.

Could be as simple as:

Debug.WriteLine("Start");
// Code, one or more line depending on the granularity you need.
Debug.WriteLine("1a");
// Code
Debug.WriteLine("1b");
// Code
Debug.WriteLine("2");
// Code
Debug.WriteLine("3a");
// Code
Debug.WriteLine("3b");
// Code
Debug.WriteLine("End of operations");

You can also use the Debug.Indent() method to minimally format the output.
0
 
LVL 2

Author Comment

by:brgdotnet
Comment Utility
Thanks Guys. Just thought I would ask Jacques, isn't Debug.Writeline only used for Console applications?
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 270 total points
Comment Utility
No, you can use it with almost any type of project. For most of them, the result goes to the Output window, that is available by default in the lower right corner of the VS screen. You can activate it through the Debug menu if it is not there.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now