WPF全局异常处理程序 [英] WPF global exception handler
本文介绍了WPF全局异常处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
实现全局Try / Catch块的最佳位置在哪里。至少我必须实现一个消息框:对不起...
解决方案
你可以处理 AppDomain.UnhandledException
事件
编辑:实际上,这个事件可能更充分: Application.DispatcherUnhandledException
Sometimes, under not reproducible circumstances, my WPF application crashes without any message. The application simply close instantly.
Where is the best place to implement the global Try/Catch block. At least I have to implement a messagebox with: "Sorry for the inconvenience ..."
解决方案
You can handle the AppDomain.UnhandledException
event
EDIT: actually, this event is probably more adequate: Application.DispatcherUnhandledException
这篇关于WPF全局异常处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文