|
@@ -1,5 +1,6 @@
|
|
|
using System;
|
|
|
using System.Linq;
|
|
|
+using System.Threading.Tasks;
|
|
|
using Avalonia;
|
|
|
using Avalonia.Controls;
|
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
@@ -19,6 +20,9 @@ public class App : Application
|
|
|
|
|
|
public override void Initialize()
|
|
|
{
|
|
|
+ TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
|
|
|
+ MobileLogging.LogException += MobileLogging_LogException;
|
|
|
+
|
|
|
CoreUtils.RegisterClasses();
|
|
|
ComalUtils.RegisterClasses();
|
|
|
CoreUtils.RegisterClasses(typeof(App).Assembly);
|
|
@@ -26,9 +30,19 @@ public class App : Application
|
|
|
AvaloniaXamlLoader.Load(this);
|
|
|
}
|
|
|
|
|
|
+ private void MobileLogging_LogException(Exception ex, string? tag)
|
|
|
+ {
|
|
|
+ HandleException(ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)
|
|
|
+ {
|
|
|
+ HandleException(e.Exception);
|
|
|
+ }
|
|
|
+
|
|
|
public static void HandleException(Exception e)
|
|
|
{
|
|
|
- MobileLogging.Log(CoreUtils.FormatException(e));
|
|
|
+ MobileLogging.LogError(CoreUtils.FormatException(e));
|
|
|
}
|
|
|
|
|
|
public override void OnFrameworkInitializationCompleted()
|