倾倒编程调用堆栈 [英] Dumping the call stack programatically
本文介绍了倾倒编程调用堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
寻找一种方式来编程转储调用堆栈和.NET赢窗体应用程序时,曾经的code段被击中。它的东西我还没有碰到过,但会来救我的一些调试时间。
更新:忘了补充,多少开销,将它添加到应用程序,也就是将它慢下来相当
。解决方案
System.Environment.StackTrace
会给你当前栈作为一个字符串。
您也可以使用堆栈跟踪
类为其他人指出,如果你有更高级的需求。
Looking for a way to programatically 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.
解决方案
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.
这篇关于倾倒编程调用堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文