Eddy is right; and catching exception where
Application.Run()
is done makes no sense.
Also, to get
Application.ThreadException
triggered
don't forget this (in
Main()
):
Application.SetUnhandledExceptionMode(
UnhandledExceptionMode.CatchException);
ThreadException handler should be set up like this:
Application.ThreadException += (sender, args) => {
MessageBox.Show(string.Format(
"{0}:\n\n{1}", args.Exception.GetType().Name,
args.Exception.Message),
string.Format(
" {0}: Error", ProductName),
MessageBoxButtons.OK, MessageBoxIcon.Error);
};