Have you looked at:

http://samples.gotdotnet.com/quickstart/howto/doc/WinForms/WinFormsAppEr
rorHandler.aspx

Windows Forms installs a message pump exception handler. You can
override this to use you own dialig as per above. My guess is that this
is trapping the error before your AppDomain exception handler. 

Under the debugger we remove our exception handler so as not to
interfere with your ability to debug your app - hence the behavior
difference you are seeing 

mark

-----Original Message-----
From: Paul Stevens [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, June 11, 2002 5:43 AM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Unhandled Exception Management

I am moving this thread here from the DOTNET List, Hope no one minds

I have run into e few strange problems when using different methods to
handle "unhandled" exceptions

I have tried catching all unhandled exceptions in the following two ways

1. Put a try Catch Block around Application.Run
2. Use The Appdomain's Unhandled Exception Event

Both of these work great while I am running my code using VS but the
moment
I Compile and run the exe these stop working in both cases it is as if
the
code does not exist

Upon further testing I found the following strange behaviour in the
Compiled
Versions Both Debug and release builds have the same behaviour, if a
throw
an exception in  sub new of a form without handling it  the unhandled
exception event is triggered and everything works fine, if however I
throw
the same exception in the click event of a button its Does Not work,
Keep in
mind that when running this from VS it all works flawlessly. I am
obviously
doing something wrong but what?

Just for those who are curious as to why I am doing this , Basically I
am
creating a Class where unhandled exceptions that occur in applications
we do
are handled similar to the way Microsoft does it in Windows XP etc when
one
of our Apps Crash a The Exception is caught, a brief description is
given to
the user and the user is given the option to send the data to us, if the
user clicks send the Exception is transferred to a custom class,
Serialized
and sent to our server using a webservice, on the server the exception
is
Deserialized  the data is recorded in a DB and a Call is loged with our
QA
Support Desk, the App can then Check to see if the problem is a known
issue
and if so download whatever is needed to fix it and update itself

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to