jbk*_*kkd 5 c# exception facebook-c#-sdk windows-8
我正在构建一个Windows 8应用程序,并提出以下异常:
SuspensionManager失败
运行以下代码时:
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
await SuspensionManager.SaveAsync();
deferral.Complete();
}
Run Code Online (Sandbox Code Playgroud)
该方法的第三行发生异常,并没有真正提供任何细节.
我在网上找不到任何有用的东西.谁看过这个吗?
//编辑
这可能与我使用dynamic
Windows 8 Facebook SDK 的类型变量这一事实有关.
是dynamic
变量不允许?
//编辑2
这是dynamic
变量的用法:
dynamic result = await FB.GetTaskAsync("fql", parameters);
if (result.data.Count > 0)
{
return result.data[0].src_big as string;
}
Run Code Online (Sandbox Code Playgroud)
以及异常的调用堆栈:
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]
Run Code Online (Sandbox Code Playgroud)
前三个是外部代码,第四个是我在App.xaml.cs中的方法.
找到答案了,这完全与Facebook-sdk无关。
我在暂停时在 pageState 中保存了位图图像,显然这不起作用。
这是旧代码:
BitmapImage img = RandomImage.ImageSource as BitmapImage;
pageState["currentImage"] = img;
Run Code Online (Sandbox Code Playgroud)
和新的:
BitmapImage img = RandomImage.ImageSource as BitmapImage;
Uri uriSource = img.UriSource;
pageState["currentImage"] = uriSource;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3325 次 |
最近记录: |