“未找到资源 MultipleIdDefinition”关于 Windows Phone 7 上的反序列化

发布于 2024-10-17 21:46:02 字数 4182 浏览 2 评论 0原文

我突然开始从我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云柯 2024-10-24 21:46:02

如果您没有故意反序列化任何 XML,那么我只能猜测:

  • 应用程序的独立存储包含一些应用程序状态 XML(例如来自 AppSettings)
  • ,或者配置 XML 存在问题您的应用程序

要尝试解决此问题,您可以:

  1. 查看项目的 Properties 文件夹 - 那里的 XML 配置文件是否正常?如果您在编辑器中打开它们,是否会显示任何警告或错误?
  2. 从模拟器和/或手机中卸载应用程序(您甚至可以尝试重新启动模拟器或将手机恢复出厂设置)

如果没有,请发布更多信息,我们将尽力帮助更多 - 有趣的问题!

If you're not knowlingly deserializing any XML, then I can only guess that either:

  • the app's isolated storage contains some app-state XML (e.g. from AppSettings)
  • or that there's a problem with the configuration XML for your app

To try to fix this, you could:

  1. Take a look in the Properties folder of your project - are the XML configuration files there OK? If you open them in the editor, are there any warnings or errors shown?
  2. Uninstall the app from the emulator and/or from your phone (you can even try restarting the emulator or factory resetting the phone)

If not, post more info and we'll try to help more - interesting problem!

只为一人 2024-10-24 21:46:02

如果您正在使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文