通用Windows应用程序崩溃,没有例外?

时间:2016-03-04 21:47:05

标签: debugging crash in-app-purchase win-universal-app

我有一个应用程序,有时在尝试在Windows Phone 10上进行应用程序内购买时崩溃。它似乎崩溃而没有抛出异常。我想也许另一个线程正在崩溃的应用程序?但是,App UnhandledException事件似乎没有发送。

  • 运行RequestProductPurchaseAsync(sku)大约5秒后崩溃。
  • 如果附加调试器,它不会崩溃。 (这让我很困惑。)
  • 显示RequestProductPurchaseAsync(sku)之前的日志并将其写入磁盘。
  • 我从未在OnUnhandledException
  • 中看到登录信息
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
    {
        try {
            if (IsSimulation) {
                purchaseResult = await CurrentAppSimulator.RequestProductPurchaseAsync(sku);
            }
            else {
                Debug.Log("PurchaseProductAsync is attempting REAL PURCHASE NOW!");
                // Crash ~5 seconds into this call. No exception is thrown.
                purchaseResult = await CurrentApp.RequestProductPurchaseAsync(sku);
                //  This does not display.
                Debug.Log("PurchaseProductAsync got result " + (purchaseResult == null ? "null" : purchaseResult.Status.ToString()));
            }
        }
        catch (Exception purchaseExc) {
            purchaseResult = null;
            result.ErrorCode = "-285";
            result.ErrorException = purchaseExc;
            result.ErrorMessage = "Exceptional Error";
            Debug.Log("PurchaseProductAsync got an exception when attempting to purchase from CurrentApp or CurrentAppSimulator. " + purchaseExc.GetType() + ": " + purchaseExc.Message);
        }
    });

关于如何捕获或调试此崩溃的任何想法?

public App()
{
    this.InitializeComponent();
    appCallbacks = new AppCallbacks();
    UnhandledException += OnUnhandledException;
}

private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    // Never seems to run
    Debug.Log("Received unhandled exception");
}

0 个答案:

没有答案