Solved

Call Stack During Design Time?

Posted on 2009-07-10
6
158 Views
Last Modified: 2013-11-26
Is there a way to quickly see the call stack for a function when you're not in run time in Visual Studio?  It would be nice to hover inside a method and see the different places it coud be called from instantly.
0
Comment
Question by:NigelRocks
  • 3
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
abel earned 400 total points
ID: 24826082
I assume you mean that you want to see the call stack as if you hit a breakpoint in a function while you use a control in design time? Though you don't mention whether this is for a usercontrol in ASP.NET or for a windows forms usercontrol, in both cases it is needed that your control is inside a separate project, i.e., a class library. Select debug build and assign the debug version to your forms project.

Then you simply add a breakpoint and the breakpoint will be hit.

I'm not entirely sure, but I do remember that something like Debbugger.Break() (on the line where you want your breakpoint) also worked when it wasn't in a separate project, but I'm not entirely sure.

-- Abel --
0
 
LVL 39

Assisted Solution

by:abel
abel earned 400 total points
ID: 24826159
Btw: it is always possible to use reflection to dynamically call the stack (or raise + catch an exception and use the ex.stackTrace) and log that to a file. This will also work when the usercontrol is inside the current project. It will, however, not work with Debug.WriteLine or Console.WriteLine. Why not is beyond me, but these only work when you put it in a separate project.

Incidentally, I'm working on an in-depth article that describes design time vs user/run time on my blog, because if you need to run code based on one of these conditions, Control.DesignTime will not always give what you want.
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 24826636
Right click on the Method Name and select "Find All References".  Then you should find the "Find Symbol Results" Panel down below with a Tree of every "reference" to the thing you searched for.  Double click on each entry to jump there in the code.

Here is an example of what it might look like:
FindAllReferences.jpg
0
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.

 
LVL 39

Expert Comment

by:abel
ID: 24826938
Is that a stack, Idle? (just wondering)
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 24827443
A stack?...definitely not.  =)

I think NigelRocks is just using the wrong terminology.

I was going off his description of what he wanted:

    "It would be nice to hover inside a method and see the different places it coud be called from instantly."

The "Find All References" search results will show all the different places in the code where the method is being called.
0
 
LVL 1

Author Closing Comment

by:NigelRocks
ID: 31602208
Idle_Mind, maybe I didn't word things right, so I gave you points anyway.  I've been using the "find all references" and found it somewhat helpful, but what I was really look for is an order of execution without being in run-time.  Why?  I suppose it's because I'm just too damn lazy to hit "F5" on my keyboard.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 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