Reputation: 5021
I using this EventHandler to catch all unhandled exceptions.
public App()
: base()
{
this.Dispatcher.UnhandledException += OnDispatcherUnhandledException;
}
void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
...
}
I want to show the stack trace of the exeption (except the error message) like in this picture:
How can I do that?
Upvotes: 1
Views: 2861
Reputation: 69959
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;
}
You can find out more from the Exception
class page on MSDN. Please let me know if I have misunderstood your problem.
Upvotes: 4