积极答复者
关于App的UnhandledException

问题
答案
-
这个肯定无法拿到所有类型崩溃,在他的文档说明中有写 http://msdn.microsoft.com/zh-cn/library/windows/apps/windows.ui.xaml.application.unhandledexception.aspx
This event is only used with exceptions encountered by the XAML framework. Exceptions encountered by other Windows Runtime components or parts of the application that are not connected to the XAML framework will not result in this event being raised. For example, if a different Windows component calls into application code and an exception is thrown and not caught, the UnhandledException event won’t be raised. If the application creates a worker thread, and then raises an exception on the worker thread, the UnhandledException event won’t be raised.
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已建议为答案 Damon.Tian 2012年10月18日 1:36
- 已标记为答案 Jie BaoModerator 2012年10月25日 9:26
全部回复
-
VS 会添加如下的代码 在Debug时候来捕获,
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION UnhandledException += (sender, e) => { if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break(); }; #endif
所以你在实际情况下,不是Debug下是可以捕获的。你换成Release 来测试:
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
-
这个肯定无法拿到所有类型崩溃,在他的文档说明中有写 http://msdn.microsoft.com/zh-cn/library/windows/apps/windows.ui.xaml.application.unhandledexception.aspx
This event is only used with exceptions encountered by the XAML framework. Exceptions encountered by other Windows Runtime components or parts of the application that are not connected to the XAML framework will not result in this event being raised. For example, if a different Windows component calls into application code and an exception is thrown and not caught, the UnhandledException event won’t be raised. If the application creates a worker thread, and then raises an exception on the worker thread, the UnhandledException event won’t be raised.
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已建议为答案 Damon.Tian 2012年10月18日 1:36
- 已标记为答案 Jie BaoModerator 2012年10月25日 9:26
-
C#代码也不是说肯定要捕获。他只关心 exceptions encountered by the XAML framework, 与语言无关。
Bob Bao [MSFT]
MSDN Community Support | Feedback to us