Solved

Call Stack During Design Time?

Posted on 2009-07-10
6
160 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
[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
  • 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 86

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 39

Expert Comment

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

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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