protected override void OnExit(ExitEventArgs e) { if (_instanceMutex != null) { _instanceMutex.ReleaseMutex(); } CursorManager.RestoreOriginalCursors(); base.OnExit(e); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (e.ExceptionObject is Exception ex) { Logger.LogError("Unhandled exception", ex); } else { Logger.LogError("Unhandled exception"); } CursorManager.RestoreOriginalCursors(); }
public static void Main() { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; try { var application = new App(); application.InitializeComponent(); application.Run(); } catch (Exception ex) { Logger.LogError("Unhandled exception", ex); CursorManager.RestoreOriginalCursors(); } }
public static void Main(string[] args) { _args = args; Logger.LogInfo($"Color Picker started with pid={Environment.ProcessId}"); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; try { using (var application = new App()) { application.InitializeComponent(); application.Run(); } } catch (Exception ex) { Logger.LogError("Unhandled exception", ex); CursorManager.RestoreOriginalCursors(); } }
public static void Main(string[] args) { _args = args; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; try { using (var application = new App()) { application.InitializeComponent(); application.Run(); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) #pragma warning restore CA1031 // Do not catch general exception types { Logger.LogError("Unhandled exception", ex); CursorManager.RestoreOriginalCursors(); } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Logger.LogError("Unhandled exception", (e.ExceptionObject is Exception) ? (e.ExceptionObject as Exception) : new Exception()); CursorManager.RestoreOriginalCursors(); }