-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (40 loc) · 1.37 KB
/
Program.cs
File metadata and controls
46 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Avalonia;
using SqlVersionControl.Services;
using Velopack;
namespace SqlVersionControl;
sealed class Program
{
[STAThread]
public static void Main(string[] args)
{
VelopackApp.Build().Run(); // MUST be first line
// Global exception handlers — catch crashes before the process dies
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
{
CrashLogger.LogCrash(e.ExceptionObject as Exception);
AppLogger.LogError("UnhandledException", e.ExceptionObject as Exception ?? new Exception("Unknown fatal error"));
};
TaskScheduler.UnobservedTaskException += (_, e) =>
{
CrashLogger.LogCrash(e.Exception);
AppLogger.LogError("UnobservedTaskException", e.Exception);
e.SetObserved(); // prevent termination
};
try
{
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
catch (Exception ex)
{
CrashLogger.LogCrash(ex);
AppLogger.LogError("Main.FatalCrash", ex);
throw; // re-throw so the OS sees the crash
}
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}