SuspensionManager.RestoreAsync中的异常 [英] Exception in SuspensionManager.RestoreAsync
问题描述
有时如果我使用CTRL + SHIFT + F5退出我的应用程序并重新启动它,我会在这一行得到一个例外:
Sometimes if I use CTRL+SHIFT+F5 to exit my application and restart it, I get an exception on this line:
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
// Do an asynchronous restore
await SuspensionManager.RestoreAsync();
}
用户代码未处理System.IO.FileNotFoundException
HResult = -2147024894
消息=系统找不到指定的文件。 (HRESULT的例外情况:0x80070002)
来源= mscorlib
StackTrace:
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at NZWeather.Common.SuspensionManager。< RestoreAsync> d__9.MoveNext()in c:\projectswpf \WinRt \NZWeather\NZWeather\Common \SuspensionManager.cs:line 100
&NBSP;&NBSP;&NBSP; ---抛出异常的前一个位置的堆栈跟踪结束---
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在System.Runtime.CompilerServices.TaskAwaiter.GetResult()
[...]
System.IO.FileNotFoundException was unhandled by user code
HResult=-2147024894
Message=The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Source=mscorlib
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at NZWeather.Common.SuspensionManager.<RestoreAsync>d__9.MoveNext() in c:\projectswpf\WinRt\NZWeather\NZWeather\Common\SuspensionManager.cs:line 100
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
[...]
大概这是因为我的应用程序已经停止并且没有保存会话状态但是Windows已经决定它已被终止。
Presumably this is because my application was stopped and did not save session state, but Windows has decided that it has been terminated.
所以问题是,是否需要在暂停管理器中进行一些更改来处理这种情况,或者它是否是一个错误Windows错误地报告它已被终止?
So the question is, do there need to be some changes in suspension manager to handle this sort of situation, or is it a bug in Windows that it is incorrectly reporting that it was terminated?
... Stefan
...Stefan
推荐答案
嗨Stefan,
Hi Stefan,
感谢您报告该问题,有三个问题可以帮助我们成功跟踪问题:
Thanks for reporting that issue, three questions to help us track successfully the issue:
1。它是否在您的盒子上使用默认的C#Grid App和Split App tempates重现?
1. Does it reproduce on your box with the default C# Grid App and Split App tempates?
2。与您的应用程序的一致性如何?每次,10分之一,任何估计都可以。
2. How consistent is it with your app? Everytime, 1 of 10, any estimate would work.
3。在这种情况下,这不会重现PreviousExecutionState的状态是什么?我想知道它是否不同,或者只是RestoreAsync间歇性地失败。我只看到"NotRunning"无论我重启应用程序多少次。
3. In the cases when this doesn't repro what is the state of PreviousExecutionState? I wonder if it is different, or just the RestoreAsync fails intermittently. I see only "NotRunning" no matter how many times I restart apps.
谢谢!
Ivan
这篇关于SuspensionManager.RestoreAsync中的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!