Is it possible to handle exceptions on the AppDomain.CurrentDomain.UnhandledException callback? I want to do the following:
- Show my own "an exception has occured" dialog, with a "Send Report" button
- After the user dismissed the box, I want to close my app, but I do not want 开发者_运维问答to Windows default crash dialog "The application needs to close" box to show up.
Can this be done?
You could to use Application.SetUnhandledExceptionMode
method.
Please, take also a look here: User Friendly Exception Handling.
Hope this link helps:
http://www.switchonthecode.com/tutorials/csharp-tutorial-dealing-with-unhandled-exceptions
As the code shows, just listen to the exception and do what you want when it happens.
精彩评论