我正在构建一个
Windows 8应用程序,并提出以下异常:
private async void OnSuspending(object sender,SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); await SuspensionManager.SaveAsync(); deferral.Complete(); }
该方法的第三行发生异常,并没有真正提供任何细节.@H_404_4@
我在网上找不到任何有用的东西.谁看过这个吗?@H_404_4@
//编辑@H_404_4@
这可能与我使用Windows 8 Facebook SDK的动态类型变量这一事实有关.@H_404_4@
是不允许动态变量?@H_404_4@
//编辑2@H_404_4@
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]
解决方法
找到了答案,这完全不是Facebook-sdk的相关内容.
我在暂停时在pageState中保存了一个Bitmap图像,显然这不起作用.@H_404_4@
BitmapImage img = RandomImage.ImageSource as BitmapImage; pageState["currentImage"] = img;
和新的:@H_404_4@
BitmapImage img = RandomImage.ImageSource as BitmapImage; Uri uriSource = img.UriSource; pageState["currentImage"] = uriSource;