From: Christoph Basedau on 1 Jun 2010 06:43 Hi in order to give the user a last info before his app dies, due to uncaught exceptions we implemented the code from msdn (<URL:http://msdn.microsoft.com/en- us/library/ms223898.aspx>) that utilizes Application.SetUnhandled, Application.ThreadException, AppDomain.CurrentDomain.UnhandledException. As expected unhandled non-UI exceptions no go through our method 'OnUnhandledException' and a last grave note is displayed to our user. Nonetheless after 'OnUnhandledException' is out of scope, the runtime still crashes with sth like "windows encountered a problem with app.exe, app.exe is shutdown". This msg also occurs when unhandled exceptions are not directed to any handler. Is there a way to suppress this OS-crash message? Thx Christoph
From: Peter Duniho on 1 Jun 2010 11:45 Christoph Basedau wrote: > Hi > > in order to give the user a last info before his app dies, due to > uncaught exceptions > we implemented the code from msdn (<URL:http://msdn.microsoft.com/en- > us/library/ms223898.aspx>) that utilizes > > Application.SetUnhandled, > Application.ThreadException, > AppDomain.CurrentDomain.UnhandledException. > > As expected unhandled non-UI exceptions no go through our method > 'OnUnhandledException' > and a last grave note is displayed to our user. > Nonetheless after 'OnUnhandledException' is out of scope, the runtime > still > crashes with sth like "windows encountered a problem with app.exe, > app.exe is shutdown". > This msg also occurs when unhandled exceptions are not directed to any > handler. > > Is there a way to suppress this OS-crash message? Yes. Catch the exception that is currently unhandled. The UnhandledException and ThreadException events don't allow you to handle the exception. They just allow you to learn when an exception has been unhandled. But, if the handlers for those events are called, then it means you still have an unhandled exception. And if you still have an unhandled exception, then Windows is still going to see the program crash. Pete
From: Christoph Basedau on 2 Jun 2010 07:59 On 1 Jun., 17:45, Peter Duniho <no.peted.s...(a)no.nwlink.spam.com> wrote: > Christoph Basedau wrote: > > [Handling uncaught exceptions] using > > Application.SetUnhandledExceptionMode, > > Application.ThreadException, > > AppDomain.CurrentDomain.UnhandledException. > > > > still raises "windows OS-crash message" > > > Is there a way to suppress this OS-crash message? > > Yes. Catch the exception that is currently unhandled. > > The UnhandledException and ThreadException events don't allow you to > handle the exception. They just allow you to learn when an exception > has been unhandled. But, if the handlers for those events are called, > then it means you still have an unhandled exception. And if you still > have an unhandled exception, then Windows is still going to see the > program crash. Hi Pete, thx for your reply Sounds somehow reasonable to me these eventhandlers don't automagically handle any exception. Chris
|
Pages: 1 Prev: WCF Client serialization problem Next: Fading in and out. |