UWP应用程序(.NET Native)和未处理的异常

5
我创建了一款用于Windows 10桌面的uwp应用(.Net native)。我使用HockeyApp来收集实时崩溃报告。堆栈跟踪信息不够详细。这是一个长期存在的问题,目前还没有解决方案。我尝试了this,但它没起作用。
我遇到了以下异常:
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
Arg_NullReferenceException

Microsoft.HockeyApp.Extensibility.Windows.UnhandledExceptionTelemetryModule.CoreApplication_UnhandledErrorDetected
 The parameter is incorrect. The parameter is incorrect.

在我的电脑上,该应用程序运行稳定。也许这是由于Windows版本的原因。我认为这也与我的xaml有关。对我来说,纠正这些错误非常重要。但我不能放弃表格。有什么想法如何找到这些错误的源头吗?
1个回答

13

很抱歉,这可能不是一个答案,但评论框里没有足够的空间。


尝试在你的 App.xaml.cs 中添加以下内容。添加处理程序到这些事件中,看它们是否返回关于崩溃的信息。

public App()
{
    UnhandledException += OnUnhandledException;
    TaskScheduler.UnobservedTaskException += OnUnobservedException;

    InitializeComponent();
}

private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    // Occurs when an exception is not handled on the UI thread.


    // if you want to suppress and handle it manually, 
    // otherwise app shuts down.
    e.Handled = true; 
}

private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e)
{
    // Occurs when an exception is not handled on a background thread.
    // ie. A task is fired and forgotten Task.Run(() => {...})


    // suppress and handle it manually.
    e.SetObserved();
}

e.Handled = true; 对我来说并没有影响程序终止。你有什么想法,可能是什么原因导致这种情况? - Beltway

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接