mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Handle TaskSchedulerUnhandledException
This commit is contained in:
parent
6b9c9e9eb7
commit
eaac72b696
2 changed files with 19 additions and 0 deletions
|
|
@ -153,6 +153,7 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
RegisterAppDomainExceptions();
|
RegisterAppDomainExceptions();
|
||||||
RegisterDispatcherUnhandledException();
|
RegisterDispatcherUnhandledException();
|
||||||
|
RegisterTaskSchedulerUnhandledException();
|
||||||
|
|
||||||
var imageLoadertask = ImageLoader.InitializeAsync();
|
var imageLoadertask = ImageLoader.InitializeAsync();
|
||||||
|
|
||||||
|
|
@ -284,6 +285,15 @@ namespace Flow.Launcher
|
||||||
AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle;
|
AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// let exception throw as normal is better for Debug
|
||||||
|
/// </summary>
|
||||||
|
[Conditional("RELEASE")]
|
||||||
|
private static void RegisterTaskSchedulerUnhandledException()
|
||||||
|
{
|
||||||
|
TaskScheduler.UnobservedTaskException += ErrorReporting.TaskSchedulerUnobservedTaskException;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable
|
#region IDisposable
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Flow.Launcher.Infrastructure;
|
using Flow.Launcher.Infrastructure;
|
||||||
|
|
@ -30,6 +31,14 @@ public static class ErrorReporting
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void TaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
//handle unobserved task exceptions
|
||||||
|
Report(e.Exception);
|
||||||
|
//prevent application exist, so the user can copy prompted error info
|
||||||
|
e.SetObserved();
|
||||||
|
}
|
||||||
|
|
||||||
public static string RuntimeInfo()
|
public static string RuntimeInfo()
|
||||||
{
|
{
|
||||||
var info =
|
var info =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue