Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Method call stack

Posted on 2007-11-14
Medium Priority
Last Modified: 2011-10-03
Could I have a code snippet to obtain the method call stack, maybe in an array, for debugging purposes.
I intend to dump the stack when an error is intercepted.
If Main, calls Method1, which calls Method2,
I'd like to have some kind of structure which holds:
as its contents.

I'd be extra happy if I could also have some structure holding all current local variables.  Wow - that would be helpful as something to write out to an error log for inspection after failure.

Question by:andremara
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
LVL 22

Accepted Solution

RedKelvin earned 2000 total points
ID: 20284862
try using Environment.StackTrace


As for the locals, I am thinking about it, but it is a tough one

Author Comment

ID: 20285038
Very cool about StackTrace. Works like a champ.  Thanks.
Maybe I'll put the locals question separately - you got points!

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

636 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