Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the actual StackTrace object from an Exception

An Exception object has a StackTrace property on it. But it is just a string.

Is there a way to get an actual System.Diagnostics.StackTrace object from an Exception?

I ask because I am getting the Exception object from an UnhandledExceptionEventHandler and I don't have access to the frame that generated the exception to get an actual Stack Trace.

like image 279
Vaccano Avatar asked Nov 16 '25 05:11

Vaccano


1 Answers

try{
//some code
}
catch (Exception ex){
   System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(ex);
}
like image 69
PALMERALE Avatar answered Nov 17 '25 19:11

PALMERALE