|
-
Mar 27th, 2009, 03:00 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Handling an unhandled exception
I have an unhandled exception event in the ApplicationEvents area of my program, but it never gets called when I do get unhandled exceptions. Is there a trick to making this work?
-
Mar 27th, 2009, 03:03 PM
#2
Re: Handling an unhandled exception
It should capture any exception in your app that wasn't caught/handled by another exception handler somewhere.
Did you check your code to make sure you don't have a try block around some main entry point in your code that is supressing the error instead of letting it bubble up to the application framework unhandled exception handler?
-
Mar 27th, 2009, 03:05 PM
#3
Re: Handling an unhandled exception
"The Visual Basic compiler prevents applications that are built for debugging from raising this event, to allow a debugger to handle the unhandled exceptions. This means that if you are testing your application by running it under the Visual Studio Integrated Development Environment debugger, your UnhandledException event handler will not be called. For more information on building applications for debugging, see /debug (Visual Basic)."
-
Mar 27th, 2009, 03:08 PM
#4
Thread Starter
Frenzied Member
Re: Handling an unhandled exception
Hey thanks, I didn't know that. So it should work fine in my compiled app?
-
Mar 27th, 2009, 03:12 PM
#5
Re: Handling an unhandled exception
just run your app in the IDE with ctrl+F5 instead of just F5/play button, and it should run without debugging.
-
Mar 27th, 2009, 03:14 PM
#6
Thread Starter
Frenzied Member
Re: Handling an unhandled exception
That was the problem. When I compiled & ran the app it caught the unhandled exception. Is there any limitations on what code can be run under that event? Also, is it possible to get the details of the exception? (like the stack trace)
-
Mar 27th, 2009, 03:18 PM
#7
Thread Starter
Frenzied Member
Re: Handling an unhandled exception
OK, I found e.Exception.StackTrace & e.Exception.Message
-
Mar 27th, 2009, 03:20 PM
#8
Re: Handling an unhandled exception
You can also set e.ExitApplication to toggle if the app should close, or if it should try to continue on (like if you reset everything back to scratch and start up over on an unhandled exception, versus the app just closing and the user needing to reopen the app)
-
Mar 27th, 2009, 03:31 PM
#9
Thread Starter
Frenzied Member
Re: Handling an unhandled exception
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|