Application Object and SetUnhandledExceptionMode

I was going to write a Win Forms application which normally starts with my putting in my unhandled exception code. I see that the application class now has a UnhandledExceptionMode Method, with members of
Automatic
CatchException
ThrowException

Any idea of what this does or how to use it. I found nothing in the help doc or on the web.
[549 byte] By [chuck02323] at [2008-2-5]
# 1
chuck02323 wrote:
I was going to write a Win Forms application which normally starts with my putting in my unhandled exception code. I see that the application class now has a UnhandledExceptionMode Method, with members of
Automatic
CatchException
ThrowException

Any idea of what this does or how to use it. I found nothing in the help doc or on the web.


chuck02323,

This is actually an enumeration in the System.Windows.Forms namespace. It is used on the NativeWindow class, where you can tell it what to do when an unhandled exception is caught. You would call the SetUnhandledExceptionMode method.

Hope this helps.

- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

casperOne at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
So if I set it to Automatic, what happens?
When what catches an unhandled exception?
What's the difference between setting ThrowException and doing nothing?
chuck02323 at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3

As per the documentation:

Automatic: Route all exceptions to the ThreadException handler, unless the application's configuration file specifies otherwise.
CatchException: Always route exceptions to the ThreadException handler. Ignore the application configuration file.
ThrowException: Never route exceptions to the ThreadException handler. Ignore the application configuration file.


DavidM.Kean at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified