uwp app(.net native)和未处理的异常

问题描述 投票:2回答:1

我为Windows 10桌面创建了uwp app(.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。对我来说纠正这些错误非常重要。但我不能拒绝这张桌子。任何想法如何找到这些错误的来源?

c# uwp unhandled-exception hockeyapp .net-native
1个回答
5
投票

对不起,这可能不是答案,但我在评论栏中没有足够的空间。


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();
}
© www.soinside.com 2019 - 2024. All rights reserved.