Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dumping the call stack programmatically

Tags:

c#

.net

debugging

Looking for a way to programmatically dump the call stack and a .net Win Forms app when ever a section of code is hit. Its something I haven't come across before but will save me some debug time.

Update: Forgot to add, how much overhead would this add to the application , i.e. would it slow it down considerably.

like image 579
RC1140 Avatar asked Nov 05 '09 07:11

RC1140


1 Answers

System.Environment.StackTrace 

Will give you the current stack as a string.

You can also use the StackTrace class as others have pointed out if you have more advanced needs.

like image 121
Ryan Cook Avatar answered Sep 18 '22 22:09

Ryan Cook