InvalidDataContractException in windows phone 7?
I am developing an app where i am navigating from different pages Particularly in one page when i am pressing the windows(start) button to come out of the app it is throwing the following exception and Message:
System.Runtime.Serialization.InvalidDataContractException:
Type 'System.Windows.SetterBase' cannot be serialized开发者_开发技巧. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
But i am not getting why this error is occurred. Any suggestions??
I would guess that when you are naivgating from that page you are either serializing something or saving something in IsolatedStorageSettings
. This uses the DataContractSerializer
internally to convert objects into something that can be persisted.
Either make sure that the object can be serialized or serialize it yourself. If you can do it yourself using a different/faster method you may be able to improve performance overall. The DataContractSerializer
is quite fast with simple types like strings.
精彩评论