namespace Vurdalakov
{
using System;
using System.Windows.Forms;
static class Program
{
[STAThread]
static void Main()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
AppDomain.CurrentDomain.UnhandledException += (s, e) => HandleUnhandledException(e.ExceptionObject as Exception);
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
catch (Exception ex)
{
HandleUnhandledException(ex);
}
Environment.Exit(0);
}
private static void HandleUnhandledException(Exception ex)
{
// Handle unhandled exception
Application.Exit();
}
}
}
Monday, January 28, 2019
C#: Handle unhandled exceptions
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment