The only thing different about the two applications is that the form
in the application that is not working is in a MDI child form. I have
pasted the same code, however, into the Main() of the parent form and
triggered an error there, with the same result, the code does not get
hit.
Are there some VID settings that I am missing that could be varying
between the applications to cause this behavior?
The code snippet that is misbehaving is as follows:
// in the form constructor
AppDomain adCurrent = AppDomain.CurrentDomain;
adCurrent.UnhandledException += new
UnhandledExceptionEventHandler(UnhandledExceptionHandler);
// in the form constructor to trigger the error
decimal dec = Convert.ToDecimal("apple");
private static void UnhandledExceptionHandler(object sender,
UnhandledExceptionEventArgs ue)
{
Exception unhandledException = (Exception) ue.ExceptionObject;
if (!EventLog.SourceExists("Intake"))
{
EventLog.CreateEventSource("Intake","Intake Log");
}
EventLog eventLog = new EventLog();
eventLog.Source = "Intake";
eventLog.WriteEntry(unhandledException.Message);
MessageBox.Show("unhandled exception");
}
Try using the Application.ThreadException instead for WinForms applications.
P.S. I would like to invite Jay Harlow to this thread, we've recently
discussed the use of these events to react on unhandled exceptionds.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Steph" <baja...@yahoo.com> wrote in message
news:ce482219.0401...@posting.google.com...
"Dmitriy Lapshin [C# / .NET MVP]" <x-c...@no-spam-please.hotpop.com> wrote in message news:<eXjWtXM...@TK2MSFTNGP10.phx.gbl>...