[UWP]处理未处理的例外情况 [英] [UWP]Handling Unhandled Exceptions
问题描述
我有一些UWP应用程序,并在我的app.xaml.cs中实现了'OnUnhandledException'。但是,它从不处理未处理的异常。除了添加之外还有什么需要发生:
UnhandledException + =< Handler> ;;在app构造函数中?
谢谢。
该事件主要用于记录异常。 &NBSP;来自MSDN文档。
通常在 UnhandledException 事件
被触发,Windows运行时终止应用程序,因为异常未处理。应用代码对此有一定的控制权:如果 UnhandledException 事件
处理程序设置 处理 属性
的事件参数 true ,
然后在大多数情况下,该应用程序将不会被终止。但是,由于以下几个原因,建议不要这样做:
I have some UWP applications and have implemented 'OnUnhandledException' in my app.xaml.cs. However, it never handles unhandled exceptions. Is there something that needs to happen besides adding:
UnhandledException += <Handler>; in the app constructor?
Thanks.
The event is mostly meant for logging the exceptions. From the MSDN docs.
Normally after the UnhandledException event is fired, the Windows Runtime terminates the app because the exception was unhandled. The app code has some control over this: if the UnhandledException event handler sets the Handled property of the event arguments to true, then in most cases the app will not be terminated. However, doing so routinely is not recommended for several reasons:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.application.unhandledexception
这篇关于[UWP]处理未处理的例外情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!