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
Solved

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

Posted on 2014-10-22
4
675 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 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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