二进制格式化程序反序列化异常 [英] Binary Formatter Deserialization Exception

查看:111
本文介绍了二进制格式化程序反序列化异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试打开使用旧应用程序(.NET)生成的序列化文件时,在新应用程序(.NET)中,然后我收到SerilizationException"无法获取成员"< Initialize> b__319_0"。



关键点

1.)序列化和反序列化在相同版本的代码中工作,没有任何例外。

2.)跨版本它不工作。

3.)它是WPF应用程序,我正在序列化从ViewModel派生的MyViewModel类。

4.)使用BinaryFormatter



详细说明

我在新版本中添加了新的变量,属性和方法(需要项目)。

现在,当我尝试在新版本中打开旧的序列化文件时,我得到序列化异常"无法获取成员"< Initialize> b__319_0'"。



要识别此问题,我评论了所有新添加的代码,并尝试在较新版本中打开旧数据(其中)我评论了新代码)这个旧数据在这个&bbsp
版本中打开,没有任何异常。



我从我的应用程序中准备了示例程序它工作正常。现在我对实际问题感到困惑,无法找到解决方案。



任何建议都会有所帮助 

谢谢你提前

When i try to open a serialized file, that is generated using old Application(.NET), in new application(.NET) then i am getting SerilizationException "Cannot get the member '<Initialize>b__319_0".

Key points
1.) Serialization and deserialization working in the same version of code without any exception.
2.) Across versions it is not working.
3.) It is WPF application and I am serializing MyViewModel class that is derived from ViewModel.
4.) Using BinaryFormatter

Detail description
I added new variables, properties and method in my class in new version(as project required).
Now when i try to open my old serialized file in new version then i get Serialization Exception "Cannot get the member '<Initialize>b__319_0'".

To Identify this issue i commented all newly added code and try to open my older data in newer version(In which i commented new code) this older data open in this 
version without any Exception.

I prepared sample program out of my application and it is working fine. Now I am really confused about the actual problem and not able to find out the solution.

Any suggestion will help 
Thank you in advance

推荐答案



嗨    Pankaj Kherodiya,



>>我添加了新变量,属性和我的课程中的新版本方法(需要项目)。

现在当我尝试在新版本中打开旧的序列化文件时,我得到序列化异常"无法获取成员"< Initialize> b__319_0'"。



为什么要改变你的班级结构。它的结构与前一个不同。解析文件时会出现问题。



>>识别这个问题我评论了所有新添加的代码并尝试在较新版本中打开我的旧数据(其中我评论了新代码)此旧数据在此打开

版本没有任何异常。



所以,我认为,问题可能是由于不同的班级结构。 



>>我从我的应用程序中准备了示例程序,它运行正常。现在我对实际问题感到困惑,无法找到解决方案。



我们也很困惑关于这个问题。我建议你可以上传一个可运行的演示给我们(包括你的测试材料并删除所有私人信息)。我们可以下载它并进行调试。这有助于我们快速分析您的问题。



以下链接可能对您有所帮助。



< a href ="https://stackoverflow.com/questions/29676594/binary-formatter-and-properties-with-without-backing-fields"> 二进制格式化程序和带有\不支持字段的属性
$


最好的问候,



Yong Lu

Hi   Pankaj Kherodiya,

>>I added new variables, properties and method in my class in new version(as project required).
Now when i try to open my old serialized file in new version then i get Serialization Exception "Cannot get the member '<Initialize>b__319_0'".

Why you change your class structure. Its structure is different from the previous one. There will be problems when you parse the file.

>>To Identify this issue i commented all newly added code and try to open my older data in newer version(In which i commented new code) this older data open in this 
version without any Exception.

So, I think, the problem may caused be the different class structure. 

>>I prepared sample program out of my application and it is working fine. Now I am really confused about the actual problem and not able to find out the solution.

We are also confused about the issue. I suggest you can upload a runnable demo to us(Including your test material and remove all private information). We can download it and debugging. This will help us quickly analyze your problem.

The following links may helpful for you.

Binary Formatter and properties with\without backing fields

Best Regards,

Yong Lu


这篇关于二进制格式化程序反序列化异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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