Hi There
I'm probably missing something fundamental here but I don't understand
the code in the OnThreadExcepti on routine, which is found in MSDN under
the topic: Application.Thr eadException Event
I think the whole OnThreadExcepti on routine could be replaced with two
lines of code:
if (ShowThreadExce ptionDialog(t.E xception) == DialogResult.Ab ort)
Environment.Exi t(0);
Why? Because:
(1) FXCop complains about the MSDN example with CA1031 :
Microsoft.Desig n : Modify ... to catch a more specific exception than
'System.Object' or rethrow the exception.
(2) I don't understand why they even bother catching an exception as
they just give a totally useless message and terminate the application
anyways:
try
{
MessageBox.Show ("Fatal Error", "Fatal Error" ...
}
finally
{
Application.Exi t();
}
(3) Environment.Exi t is more relevant for the project I am working on
as Application.Exi t(0) only seems to end the blocking
Application.Run (new myMainForm()) line. If there is code after the
Application.Run line it will still be executed. However I want to give
the application a "bullet in the head".
Thanks In Advance
Bill