gpt4 book ai didi

c# - uwp 应用程序(.net native )和未处理的异常

转载 作者:行者123 更新时间:2023-11-30 14:22:49 27 4
gpt4 key购买 nike

我为 Windows 10 桌面创建了 uwp 应用程序(.Net native)。我用 HockeyApp用于收集实时崩溃报告。堆栈跟踪不提供信息。这是一个长期存在的问题,没有解决方案。我试过 this但它不起作用。我得到这些异常(exception):

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
Arg_NullReferenceException

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

在我的电脑上,应用程序运行稳定。这可能是由于 Windows 的版本。我也认为这是由于我的 xaml。纠正这些错误对我来说非常重要。但我无法拒绝表。我有什么想法可以找到这些错误的根源吗?

最佳答案

抱歉,这可能不是答案,但我的评论框中没有足够的空间。


在您的 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();
}

关于c# - uwp 应用程序(.net native )和未处理的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48002862/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com