Skip to content

Commit 3dd5a09

Browse files
committed
feat(UnhandledException): Stack Trace
1 parent 611d909 commit 3dd5a09

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

managed/src/SwiftlyS2.Shared/Plugins/BasePlugin.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics;
12
using Microsoft.Extensions.DependencyInjection;
23
using Microsoft.Extensions.Logging;
34
using SwiftlyS2.Shared.Misc;
@@ -16,7 +17,9 @@ public BasePlugin( ISwiftlyCore core )
1617

1718
AppDomain.CurrentDomain.UnhandledException += ( sender, e ) =>
1819
{
20+
var trace = new StackTrace(true);
1921
Core.Logger.LogCritical(e.ExceptionObject as Exception, "CRITICAL: Unhandled exception in plugin. Aborting.");
22+
Core.Logger.LogCritical("Stack trace:" + string.Join("", trace.GetFrames().Select(f => $"\n at {f.GetMethod()} in {f.GetFileName()}:line {f.GetFileLineNumber()}")));
2023
};
2124

2225
TaskScheduler.UnobservedTaskException += ( sender, e ) =>

0 commit comments

Comments
 (0)