异常调用SuspensionManager.SaveAsync时() [英] Exception when calling SuspensionManager.SaveAsync()

查看:151
本文介绍了异常调用SuspensionManager.SaveAsync时()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个Windows 8应用,并都拿出了以下异常:

I'm building a Windows 8 app and have come up with the following exception:

SuspensionManager失败。

SuspensionManager failed

在运行下面的代码:

private async void OnSuspending(object sender, SuspendingEventArgs e)
{
    var deferral = e.SuspendingOperation.GetDeferral();
    await SuspensionManager.SaveAsync();
    deferral.Complete();
}



上的方法的第三行中出现的异常,并且它不真的放弃任何细节。

The exception occurs on the third line of the method, and it doesn't really give any detail.

我没有在网络上找到这方面有用的东西。有没有人见过这个?

I've failed to find anything useful regarding this on the net. Has anyone seen this before?

//修改

这可能与我使用的事实一个动态为Windows 8的Facebook SDK类型变量。

This may be related to the fact I'm using a dynamic type variable for the Windows 8 Facebook SDK.

动态变量不允许?

//编辑2

这里的<$ C的使用$ C>动态变量:

dynamic result = await FB.GetTaskAsync("fql", parameters);
if (result.data.Count > 0)
{
    return result.data[0].src_big as string;
}

和为异常调用堆栈:

mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task) + 0x5e bytes  
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) + 0x35 bytes 
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0x16 bytes   
FacebookRandomizer.exe!FacebookRandomizer.App.OnSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e) Line 86 + 0xa5 bytes  C#
[Native to Managed Transition]  

前三的外部代码,第四个是我在App.xaml.cs方法。

the first three are external code, and the fourth is my method in App.xaml.cs.

推荐答案

找到了答案,这完全不是Facebook-SDK有关。

Found the answer, and this is completely not Facebook-sdk related.

我在中止保存在pageState位图图像,并。显然这不起作用

I was saving a Bitmap image in the pageState upon suspending, and apparently this does not work.

下面是旧的代码:

BitmapImage img = RandomImage.ImageSource as BitmapImage;
pageState["currentImage"] = img;

和新一:

BitmapImage img = RandomImage.ImageSource as BitmapImage;
Uri uriSource = img.UriSource;
pageState["currentImage"] = uriSource;

这篇关于异常调用SuspensionManager.SaveAsync时()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆