?
Solved

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

Posted on 2014-10-22
4
Medium Priority
?
795 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 920 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 1080 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 1080 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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

800 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