I know this will get me yelled at, but how about Enviroment.Exit(). That should kill everything, every time =) It is still better to do the above options though.
Also:
In your Program.cs, before you call Application.Run(Form), do this:
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
and then put in a handler that is something like this:
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
try
{
String CurrentThreadName = System.Threading.Thread.CurrentThread.Name;
if (e.IsTerminating)
Logger.Log("Program", 0, String.Format("Received fatal unhandled exception on '{0}' thread. Exception will follow.", CurrentThreadName), MsgCategory.Critical, 50);
else
Logger.Log("Program", 0, String.Format("Received unhandled exception on '{0}' thread. Exception will follow.", CurrentThreadName), MsgCategory.Error, 25);
if (e.ExceptionObject != null)
Logger.LogException("Program", String.Format("Unhandled System Exception on '{0}' thread.", CurrentThreadName), 50, (Exception)e.ExceptionObject);
}
catch
{
}
if (e.IsTerminating)
{
Exception ThisException = (Exception)e.ExceptionObject;
String CurrentThreadName = System.Threading.Thread.CurrentThread.Name;
MessageBox.Show(
String.Format(Localization.GetString("fatal_error"), ThisException.GetType().ToString(), ThisException.Message, ThisException.StackTrace, CurrentThreadName)
, Localization.GetString("dialogtitle")
, MessageBoxButtons.OK
, MessageBoxIcon.Error
, MessageBoxDefaultButton.Button1);
}
}