“未找到资源 MultipleIdDefinition”关于 Windows Phone 7 上的反序列化
我突然开始从我的 Windows Phone 7 应用程序中获取此信息。我不知道反序列化数据中发生了什么变化会导致这种情况。知道这意味着什么吗?
System.Runtime.Serialization.SerializationException occurred
Message=The resource MultipleIdDefinition was not found in System.Runtime.Serialization
StackTrace:
at System.Runtime.Serialization.ReferencedObjectCache.Add(String id, Object referencedObject)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.AddNewObjectWithId(String id, Object obj, Boolean isReference)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.AddNewObject(Object obj, Boolean isReference)
at System.Runtime.Serialization.XmlFormatReader.InvokeBeforeDeserialization(ClassDataContract classContract, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlFormatReader.InitializeCallStack(DataContract clContract, XmlReaderDelegator xmlReaderDelegator, XmlObjectSerializerReadContext xmlObjContext, XmlDictionaryString[] memberNamesColl, XmlDictionaryString[] memberNamespacesColl)
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at System.Runtime.Serialization.XmlFormatReader.InternalDeserialize(Object value, Type type, String name, String ns, XmlObjectSerializerReadContext context, XmlReaderDelegator xmlReader)
at System.Runtime.Serialization.XmlFormatReader.ReadValue(Type type, String name, String ns, XmlObjectSerializerReadContext context, XmlReaderDelegator xmlReader)
at System.Runtime.Serialization.XmlFormatReader.ReadCollectionItem(CollectionDataContract collectionContract, Type itemType, String itemName, String itemNs, XmlObjectSerializerReadContext context, XmlReaderDelegator xmlReader)
at System.Runtime.Serialization.XmlFormatReader.ReadCollectionItems(DeserializedObject desObj, CollectionDataContract collectionContract, Int32 membersRead, Int32 size)
at System.Runtime.Serialization.XmlFormatReader.ReadCollection(DeserializedObject desObj, CollectionDataContract collectionContract, Int32 membersRead)
at System.Runtime.Serialization.XmlFormatReader.Deserialize(XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlFormatReader.InitializeCallStack(DataContract clContract, XmlReaderDelegator xmlReaderDelegator, XmlObjectSerializerReadContext xmlObjContext, XmlDictionaryString[] memberNamesColl, XmlDictionaryString[] memberNamespacesColl)
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
at ...
at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()
I suddenly started getting this from my Windows Phone 7 app. I don't know what changed in the data I was deserialization that would have caused this. Any idea what it means?
System.Runtime.Serialization.SerializationException occurred
Message=The resource MultipleIdDefinition was not found in System.Runtime.Serialization
StackTrace:
at System.Runtime.Serialization.ReferencedObjectCache.Add(String id, Object referencedObject)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.AddNewObjectWithId(String id, Object obj, Boolean isReference)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.AddNewObject(Object obj, Boolean isReference)
at System.Runtime.Serialization.XmlFormatReader.InvokeBeforeDeserialization(ClassDataContract classContract, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlFormatReader.InitializeCallStack(DataContract clContract, XmlReaderDelegator xmlReaderDelegator, XmlObjectSerializerReadContext xmlObjContext, XmlDictionaryString[] memberNamesColl, XmlDictionaryString[] memberNamespacesColl)
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at System.Runtime.Serialization.XmlFormatReader.InternalDeserialize(Object value, Type type, String name, String ns, XmlObjectSerializerReadContext context, XmlReaderDelegator xmlReader)
at System.Runtime.Serialization.XmlFormatReader.ReadValue(Type type, String name, String ns, XmlObjectSerializerReadContext context, XmlReaderDelegator xmlReader)
at System.Runtime.Serialization.XmlFormatReader.ReadCollectionItem(CollectionDataContract collectionContract, Type itemType, String itemName, String itemNs, XmlObjectSerializerReadContext context, XmlReaderDelegator xmlReader)
at System.Runtime.Serialization.XmlFormatReader.ReadCollectionItems(DeserializedObject desObj, CollectionDataContract collectionContract, Int32 membersRead, Int32 size)
at System.Runtime.Serialization.XmlFormatReader.ReadCollection(DeserializedObject desObj, CollectionDataContract collectionContract, Int32 membersRead)
at System.Runtime.Serialization.XmlFormatReader.Deserialize(XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlFormatReader.InitializeCallStack(DataContract clContract, XmlReaderDelegator xmlReaderDelegator, XmlObjectSerializerReadContext xmlObjContext, XmlDictionaryString[] memberNamesColl, XmlDictionaryString[] memberNamespacesColl)
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
at ...
at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您没有故意反序列化任何 XML,那么我只能猜测:
要尝试解决此问题,您可以:
如果没有,请发布更多信息,我们将尽力帮助更多 - 有趣的问题!
If you're not knowlingly deserializing any XML, then I can only guess that either:
To try to fix this, you could:
If not, post more info and we'll try to help more - interesting problem!
如果您正在使用 WCF,这可能是由于在服务器端添加了 DataContract 的“IsReference=true”而导致的。
在实际有效负载中,它会像 z:Id=”i7” 一样引人注目。
如果您有两个版本(一个工作,一个不工作),我建议尽可能深入地调试,以便您可以清楚地看到反序列化的内容,然后对两个版本进行文本比较。
If you are working with WCF, this might be caused by added "IsReference=true" of the DataContract at server side.
In actual payload it will be noticeable as something like z:Id=”i7”.
If you have two versions (one working and one not working) I would recommend to debug as deep as possible so you can clearly see stuff you deserialize, and then do text comparison of two versions.