我有一个应用程序,有时在尝试在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");
}