I would like to catch all unhandled exceptions in my UI app in C#, so that I can log them, send them by mail and restart the app.
How can I simply get this done? I tried:
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainDlg());
}
catch (Exception e)
{
Logger.Log(e);
Logger.PostLog();
System.Diagnostics.Process.Start("App.exe");
}
But it lets some exceptions through.