private static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs e) { Console.Error.WriteLine(e.Exception); Application.Exit(); }