-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
31 lines (28 loc) · 1.11 KB
/
Program.cs
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
using System;
using Serilog;
using System.Windows.Forms;
[assembly: CLSCompliant(true)]
namespace Memento
{
static class Program
{
[STAThread]
static void Main()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Memento.Forms.Memento());
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var log = new LoggerConfiguration().WriteTo.File("unhandled.log", rollingInterval: RollingInterval.Day).CreateLogger();
Exception ex = e.ExceptionObject as Exception;
MessageBox.Show(ex?.ToString() ?? "Unhandled exception");
log.Fatal(ex, "Unhandled exception");
Environment.FailFast("Unhandled exception", ex);
}
}
}