且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在WPF中显示未处理的异常的堆栈跟踪报告

更新时间:2023-08-23 14:39:28

我可能没有理解这个问题,因为我的理解,这似乎是一个很简单的问题。在 Exception 类中有一个 StackTrace 属性。您可以从该属性获取堆栈跟踪:

I might not have understood this question because to my understanding, it seems to be quite a simple question. There is a StackTrace property on the Exception class. You can get the stack trace from that property:

private void OnDispatcherUnhandledException(object sender, 
System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
    string stackTrace = e.Exception.StackTrace;
}

您可以从 异常 class 页面。如果我误解了你的问题,请让我知道。

You can find out more from the Exception class page on MSDN. Please let me know if I have misunderstood your problem.