Click here to Skip to main content
15,907,395 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi guys. I have a sub: Execute2() that's called by Execute1() .
And Execute1() is used many(hundreds) times in the main code.
during runtime I'm getting some errors and when i click pause, the cursor is at the line in the sub that the code's hanging at, which is part of Execute2().
But I really want to know which Execute1() that called Execute2() causes the error. I'm wondering whether there're some shortcuts or options in some menu that do this?Thx--
-------
currently using VB.net 2008 express.
After it's fully functional i'm moving to VS 2010.
Posted
Updated 6-Jul-12 12:10pm
v2
Comments
SandiegoSSD 6-Jul-12 17:52pm    
Well, it's going really slow now , not many people around at this moment... Happy Friday afternoon guys~ and also 4th July weekend i guess

Hey!

The 'call stack' window is the thing you're searching (in my opinion).

It's included in most visual studio (i only checked 2010 and 2005 version, so before I don't know). (You'll find it under, Debug>Windows>Call stack)

You can also find it in sharpdevelop, under View>Debug>Callstack.

You can use the callstack to go back to 'parent' subs and view the constants there...
 
Share this answer
 
v2
Comments
SandiegoSSD 6-Jul-12 18:39pm    
THX! that does it.
Sergey Alexandrovich Kryukov 6-Jul-12 18:55pm    
I agree, my 5.
Please also see my answer for a bunch of additional information and alternative way to observe/walk the stack -- very useful.
--SA
In addition to Solution 1:

First of all, one of basic things is to understand the role and operation of stack.

Now, when you talk about the "error", you probably mean that an exception was thrown. When you catch an exception, you can dump a stack at this point be reading the property System.Exception.StackTrace:
http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx[^].

This is a very important feature which can help debugging, but this is also a very good tool when you need to ask a question somewhere like CodeProject Questions & Answers.

However, this information is presented just as a string. You walk the stack during run time and get most comprehensive information is you use the class System.Diagnostics.StackTrace. Please see: http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx[^].

Pay attention for the code sample in the MSDN article referenced above.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900