开发者

Handle exceptions in AppDomain.CurrentDomain.UnhandledException

开发者 https://www.devze.com 2022-12-15 10:33 出处:网络
Is it possible to handle exceptions on the AppDomain.CurrentDomain.UnhandledException callback? I want to do the following:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消