Solved

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

Posted on 2014-10-22
4
747 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 230 total points
ID: 40397032
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
ID: 40398169
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
ID: 40399923
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
ID: 40400134
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

729 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