反序列化

时间:2018-04-28 15:29:43

标签: c# serialization casting binaryformatter

我正在尝试在32位C#exceldna addin中反序列化BinaryFormatter,它是在64位C#应用程序中序列化的。

当我调用BinaryFormatter.Deserialize(stream)时,抛出以下异常:

[A]System.Tuple`3[System.Collections.Generic.Dictionary`2[System.String,System.Int32],System.Collections.Generic.Dictionary`2[System.String,MyExcelAddin.MyPropertyNames],MyApplication.DataOutput] cannot be cast to 
[B]System.Tuple`3[System.Collections.Generic.Dictionary`2[System.String,System.Int32],System.Collections.Generic.Dictionary`2[System.String,MyExcelAddin.MyPropertyNames],MyApplication.DataOutput]. 

Type A originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. 

Type B originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'.

A和B类型看起来相同,并且来自同一个库。这里出了什么问题的线索?这是64位/ 32位的东西吗?

0 个答案:

没有答案