私のWindowsストアアプリケーションでは、待ち時間があり、完了まで数分かかる場合があります(他のスレッドのパフォーマンスについては相談します)。一方、ユーザーがアプリケーションからフォーカスを外すと、クラッシュします。私は、アプリケーション内のプリズムを使用していますWindows UWP、非同期呼び出し中に中断中にアプリケーションがクラッシュする
App was terminated because it took too long to suspend.
:私はイベントログをチェックすると、私は次のエラーを得ました。ナビゲーションパラメータを保存するため、
protected void OnApplicationSuspending(object sender, SuspendingEventArgs e)
{
var defferal = e.SuspendingOperation.GetDeferral();
if (sessionStateService.SessionState.ContainsKey("plotId"))
{
sessionStateService.SessionState.Remove("plotId");
}
sessionStateService.SessionState.Add("plotId", Plot.Id);
if (sessionStateService.SessionState.ContainsKey("Page"))
{
sessionStateService.SessionState.Remove("Page");
}
sessionStateService.SessionState.Add("Page", "OperationRecording");
defferal.Complete();
}
私も機能をOnNavigatingFrom上書きしている(と、それは他に何もしません):私は(いつもと呼ばれている)次のコードで、Application.Current.Suspending
を取り扱っています。
public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary<string, object> viewModelState, bool suspending)
{
if (viewModelState.ContainsKey("plotId"))
{
viewModelState.Remove("plotId");
}
viewModelState.Add("plotId", Plot.Id);
base.OnNavigatingFrom(e, viewModelState, suspending);
}
この問題を解決する方法はわかりません。