Solved

Call Stack During Design Time?

Posted on 2009-07-10
6
159 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 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with error in Query 2 39
Tracing a live website down to the files which support it 2 30
Need help Creating PowerShell Script 5 65
Why use this lambda? 12 62
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…
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…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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