windows-runtime - WinRt。 UnhandledException 处理程序。堆栈跟踪为空

标签 windows-runtime windows-store-apps windows-store

我在 WinForms 上有一个带有以下代码的项目:

AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;

private void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{            }
e.ExceptionObject包含完整的 StackTrace。

在 Win Store 项目中:
this.UnhandledException += (s, e) =>{                                               
{                                              
    MarkedUp.AnalyticClient.LogLastChanceException(e);
};

e.Exception.StackTrace 为空。

这两个异常都是由这段代码生成的:
int a=0;
....

try
{
    int i = 1 / a;
}
catch (Exception exp)
{
    throw;
}

有任何想法吗?

最佳答案

您是否在 Debug模式下运行解决方案?当您在 Debug模式下运行解决方案时,App.g.i.cs 文件中似乎发生了一些事情。当我在 Release 模式下运行您的示例时,堆栈跟踪在 UnhandledException 事件中可用。

在我的测试解决方案中,它首先在这里中断:

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
            UnhandledException += (sender, e) =>
            {
                if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
            };
#endif

在那之后,它转到我在 app.xaml.cs 文件中定义的 UnhandledException 处理程序。在调试中堆栈跟踪消失了,在 Release模式中堆栈跟踪和异常详细信息在那里。

关于windows-runtime - WinRt。 UnhandledException 处理程序。堆栈跟踪为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16936305/

相关文章:

c# - Windows Universal App 分组 ListView 问题

Windows 商店 - 认证失败,因为 'didn' t 似乎有用'

uwp - uwphost.dll 是什么?

uwp - Windows 应用商店的透明磁贴但彩色图标

windows-8.1 - 如何在 Windows 应用商店中分发 8.1 应用程序,但在商店中隐藏它

c# - 如何在 Snapped 模式下直接启动 MetroApp?

windows-8 - 数据绑定(bind)到 Page.BottomAppBar 中的 ElementName

vb.net - 在调用方法中不使用 Await 启动异步任务

c# - WinRT : Show upper and lower AppBar independently

c# - ScrollViewer.ChangeView 什么时候失败?