mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-27 17:09:37 +01:00
wider migration from old starter
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using StarterNG.Infrastructure;
|
||||
|
||||
namespace StarterNG;
|
||||
|
||||
@@ -7,8 +9,35 @@ class Program
|
||||
{
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
{
|
||||
if (e.ExceptionObject is Exception ex)
|
||||
Diagnostics.Log("Unhandled exception", ex);
|
||||
Diagnostics.Flush();
|
||||
};
|
||||
|
||||
TaskScheduler.UnobservedTaskException += (_, e) =>
|
||||
{
|
||||
Diagnostics.Log("Unobserved task exception", e.Exception);
|
||||
e.SetObserved();
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Diagnostics.Log("Fatal", ex);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Diagnostics.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
|
||||
Reference in New Issue
Block a user