Catch every exception of program?

你说的曾经没有我的故事 提交于 2019-12-24 01:27:15

问题


I've a WPF application which runs globally fine. But sometimes, the client tell me that he gots some crashes. But I've no information about what happened except what he does.

Is there a way to put a global try{}catch(Exception){LOGEXCEPTION; throw;} somewhere to receive all exceptions generated by a GUI action, or any other option.

Something like a "Last remedy" to log exception that we didn't manage well?

Thank you!


回答1:


By handling the following events, you should be able to catch the vast majority (if not all) unhandled exceptions in your application:

  • Application.DispatcherUnhandledException
  • AppDomain.CurrentDomain.UnhandledException


来源:https://stackoverflow.com/questions/4883208/catch-every-exception-of-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!