Solved

Call Stack During Design Time?

Posted on 2009-07-10
6
154 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

27 Experts available now in Live!

Get 1:1 Help Now