如何在应用程序中输出堆栈信息(方法调用等)? [英] How to output stack information(method call etc) in application?
本文介绍了如何在应用程序中输出堆栈信息(方法调用等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在应用程序中输出堆栈信息(方法调用等)?作为VS在控制台中输出调试信息.当我想发现异常发生时,根据堆栈跟踪,它将立即找到根本原因.
非常感谢!
How to output stack information(method call etc) in application? As VS output debug information in console. When I want to find the exception happen, according to the stack traces, it will find the root cause immediately.
Thanks a lot!
推荐答案
异常中的堆栈跟踪已向您显示了所有这些信息.为什么要自己复制功能?
如果您确实必须执行此操作,请尝试以下代码:
The stack trace in an exception shows you all that ifo already. Why duplicate the functionality on your own?
If you really must do this, try this code:
MethodInfo.GetCurrentMethod().Name
猜猜我在哪里找到的.是的,没错-Google-在所有地方都可以.我从未想过.
Guess where I found that. Yes, that''s right - google - of all places. I never woulda thunk it.
我想查看应用程序中堆栈跟踪的整个过程,就像一个输出窗口一样,当我单击一个按钮时,它将显示所有方法你打过电话.
================
来自JSOP:然后,您将必须成为一名真正的程序员,然后再做.
I want to see the entire process of the stack trace in my application, just like a output window, when I click a button ,it will show all the methods you called.
================
From JSOP: Then you''re gonna have to bea real programmer and just do it.
这篇关于如何在应用程序中输出堆栈信息(方法调用等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文