GetNavigationState不支持在Win8 RP + VS2012 RC上传递给Frame.Navigate的参数类型的序列化 [英] GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate on Win8 RP + VS2012 RC

查看:76
本文介绍了GetNavigationState不支持在Win8 RP + VS2012 RC上传递给Frame.Navigate的参数类型的序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们将复杂对象传递给Navigate方法(具有一些属性的类),当应用程序暂停时,我们调用SuspensionManager.SaveAsync方法 我们在Frame上得到以下错误。 GetNavigationState: 

If we pass a complex object to Navigate method (a class with a few properties), when the App is suspended and we invoke the SuspensionManager.SaveAsync method we get the following error on Frame.GetNavigationState: 

GetNavigationState不支持传递给Frame.Navigate 的参数类型的序列化

GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate

我尝试将无参数默认公共构造函数添加到参数类型中,并将[System.Runtime.Serialization.DataContract]和[System.Runtime.Serialization.DataMember]属性添加到其成员但是问题依然存在。

I tried to add a parameterless default public constructor to the parameter type and [System.Runtime.Serialization.DataContract] and [System.Runtime.Serialization.DataMember] attributes to its members but the issue remains.

推荐答案

我是只能使原始类型工作(即double,int,string等)。  在我看来,Frame.Navigate(Type target,object parameter)或Frame.GetNavigationState都被破坏了。   Frame.Navigate为您提供
的印象,您可以将任何对象用作导航参数,但如果这样做,Frame.GetNavigationState会抛出异常。
I've only been able to get primitive types to work (ie. double, int, string, etc).  In my opinion, either the Frame.Navigate(Type target, object parameter) or Frame.GetNavigationState are broken.  Frame.Navigate gives you the impression that you can use any object as a navigation parameter, but if you do, Frame.GetNavigationState throws an exception.


这篇关于GetNavigationState不支持在Win8 RP + VS2012 RC上传递给Frame.Navigate的参数类型的序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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