Skip to content

Commit 5045f19

Browse files
committed
Fix task scheduler unobserved task exception window issue
1 parent eaac72b commit 5045f19

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Flow.Launcher/Helper/ErrorReporting.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System;
22
using System.Threading.Tasks;
3+
using System.Windows;
34
using System.Windows.Threading;
4-
using NLog;
55
using Flow.Launcher.Infrastructure;
66
using Flow.Launcher.Infrastructure.Exception;
7+
using NLog;
78

89
namespace Flow.Launcher.Helper;
910

@@ -34,7 +35,7 @@ public static void DispatcherUnhandledException(object sender, DispatcherUnhandl
3435
public static void TaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
3536
{
3637
//handle unobserved task exceptions
37-
Report(e.Exception);
38+
Application.Current.Dispatcher.Invoke(() => Report(e.Exception));
3839
//prevent application exist, so the user can copy prompted error info
3940
e.SetObserved();
4041
}

0 commit comments

Comments
 (0)