mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-13 15:42:50 +08:00
Adds fallback for ExceptionFormatter in AOT
This commit is contained in:
parent
2a8810affd
commit
2be8e8da4e
@ -27,6 +27,13 @@ internal static class ExceptionFormatter
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
|
||||
// fallback to default ToString() if someone in an AOT is insisting on using this method
|
||||
var stackTrace = new StackTrace(exception, fNeedFileInfo: false);
|
||||
if (stackTrace.GetFrame(0)?.GetMethod() is null)
|
||||
{
|
||||
return new Text(exception.ToString());
|
||||
}
|
||||
|
||||
return new Rows(GetMessage(exception, settings), GetStackFrames(exception, settings)).Expand();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user