OnThreadException misses exceptions

C

Carl

Hi

I have in my program.cs code the followning line:

Application.ThreadException += new
ThreadExceptionEventHandler(eh.OnThreadException);

It has been working fine, catching all exceptions that is thrown, and not
caught anywhere else in the application. Now, I have a case where it does
not catch an exception! When a grid is filled with data, the DataTable event
RowChanged is triggered, in that event, an exception is raised. The IDE
stops and shows the exception, but then it just keeps executing like nothing
happened. The flow is not interrupted, and the global exception hander is
not called!! Could anyone explain this behaviour. It all seems to happen in
the same thread.

regards

Carl
 
B

Bart Mermuys

Hi,

Carl said:
Hi

I have in my program.cs code the followning line:

Application.ThreadException += new
ThreadExceptionEventHandler(eh.OnThreadException);

It has been working fine, catching all exceptions that is thrown, and not
caught anywhere else in the application. Now, I have a case where it does
not catch an exception! When a grid is filled with data, the DataTable
event RowChanged is triggered, in that event, an exception is raised.

Exception that happen inside RowChanged are swallowed (handled without
action), so they do not become unhandled Exceptions.

The IDE stops and shows the exception, but then it just keeps executing
like nothing happened. The flow is not interrupted, and the global
exception hander is not called!! Could anyone explain this behaviour. It
all seems to happen in the same thread.

Did you by any chance change Debugger settings to "break into debugger when
exception is throw" instead of only "break into debugger when exception
isn't handled" ?

HTH,
Greetings
 
C

Carl

Bart Mermuys said:
Hi,



Exception that happen inside RowChanged are swallowed (handled without
action), so they do not become unhandled Exceptions.

That explains it! Strange that MS have chosen to swallow the exception
though.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top