D
dempa
Greetings!
I have this System.Windows.Forms.Timer which I create on the fly from
an instance method (let's call it MyMethod). It has a handler for the
Tick event that throws an exception, something like this:
throw new Exception("Timeout in yadda yadda...");
I place the call to MyMethod inside a try-catch block, something like
this:
try {
MyMethod();
} catch {
Trace.WriteLine("yaddayadda","yadda");
}
Now, when I run this using "Start Debugging (F5)" it works like a
charm. When I bypass debugging with "Start Without Debugging (Ctrl-
F5)" I get an "Unhandled exception" box with the usual Details,
Continue, Quit stuff. What am I doing wrong here?
I was using System.Timers.Timer at first but after reading some docs
it seemed like a bad idea. I read somewhere that
System.Windows.Forms.Timer would make sure that my exception got
passed on to my UI thread. And it looks like it works in debug mode...
I must be missing something fundamental here... Anyone?
Regards,
Dempa
I have this System.Windows.Forms.Timer which I create on the fly from
an instance method (let's call it MyMethod). It has a handler for the
Tick event that throws an exception, something like this:
throw new Exception("Timeout in yadda yadda...");
I place the call to MyMethod inside a try-catch block, something like
this:
try {
MyMethod();
} catch {
Trace.WriteLine("yaddayadda","yadda");
}
Now, when I run this using "Start Debugging (F5)" it works like a
charm. When I bypass debugging with "Start Without Debugging (Ctrl-
F5)" I get an "Unhandled exception" box with the usual Details,
Continue, Quit stuff. What am I doing wrong here?
I was using System.Timers.Timer at first but after reading some docs
it seemed like a bad idea. I read somewhere that
System.Windows.Forms.Timer would make sure that my exception got
passed on to my UI thread. And it looks like it works in debug mode...
I must be missing something fundamental here... Anyone?
Regards,
Dempa