[Mono-bugs] [Bug 81465][Nor] New - [2.0] deserialization interop issue with missing members
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Apr 26 17:16:19 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by sebastien at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=81465
--- shadow/81465 2007-04-26 17:16:19.000000000 -0400
+++ shadow/81465.tmp.19181 2007-04-26 17:16:19.000000000 -0400
@@ -0,0 +1,145 @@
+Bug#: 81465
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: lluis at ximian.com
+ReportedBy: sebastien at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Summary: [2.0] deserialization interop issue with missing members
+
+Description of Problem:
+Mono always throw a SerializationException if a member of a structure is
+missing. MS stopped doing that in 2.0.
+
+Steps to reproduce the problem:
+1. Compile ser with HAS_STRING.
+
+C:\Temp>csc ser.cs -d:HAS_STRING
+Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
+for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
+Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
+
+2. Execute ser.exe. The output will have a serialized structure with an
+int32 and a string.
+
+C:\Temp>ser
+Serializing x 2147483647 as a System.Int32
+
+3. Recompile ser.cs without HAS_STRING
+
+C:\Temp>csc ser.cs
+Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
+for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
+Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
+
+4. Execute ser.exe with the previous serialized output.
+C:\Temp>ser System.Int32.serialized
+x 2147483647
+
+Actual Results:
+Works on MS 2.0.
+Fails on MS 1.1.
+Fails on Mono - both 1.1 and 2.0 profile.
+
+Expected Results:
+Should work on Mono 2.0 profile.
+
+How often does this happen?
+Always (Mono 2.0 profile)
+
+Additional Information:
+
+If executed with MS 1.1 the result of the deserialization (step 4) is:
+
+Unhandled Exception: System.Runtime.Serialization.SerializationException:
+Possib
+le Version mismatch. Type X has 1 members, number of members deserialized is 2.
+ at
+System.Runtime.Serialization.Formatters.Binary.ReadObjectInfo.GetMemberTyp
+es(String[] inMemberNames)
+ at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String
+obje
+ctName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
+typeInf
+ormationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
+objectId, Bi
+naryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create(String nam
+e, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
+typeInformat
+ionA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId,
+BinaryA
+ssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
+ at
+System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWi
+thMapTyped(BinaryObjectWithMapTyped record)
+ at
+System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWi
+thMapTyped(BinaryHeaderEnum binaryHeaderEnum)
+ at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(He
+aderHandler handler, __BinaryParser serParser, Boolean fCheck,
+IMethodCallMessag
+e methodCallMessage)
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
+(Stream serializationStream, HeaderHandler handler, Boolean fCheck,
+IMethodCallM
+essage methodCallMessage)
+ at Program.Main(String[] args)
+
+
+When compiled with MCS or GMCS Mono outputs
+
+poupou at pollux:~/src/bugzilla> gmcs ser.cs -d:HAS_STRING
+poupou at pollux:~/src/bugzilla> mono ser.exe
+Serializing x 2147483647 as a System.Int32
+poupou at pollux:~/src/bugzilla> gmcs ser.cs
+poupou at pollux:~/src/bugzilla> mono ser.exe System.Int32.serialized
+
+Unhandled Exception: System.Runtime.Serialization.SerializationException:
+Field "str" not found in class X
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata
+(System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean
+hasTypeInfo) [0x00000]
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance
+(System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean
+hasTypeInfo, System.Int64& objectId, System.Object& value,
+System.Runtime.Serialization.SerializationInfo& info) [0x00000]
+ at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject
+(BinaryElement element, System.IO.BinaryReader reader, System.Int64&
+objectId, System.Object& value,
+System.Runtime.Serialization.SerializationInfo& info) [0x00000]
+ at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject
+(BinaryElement element, System.IO.BinaryReader reader, System.Int64&
+objectId, System.Object& value,
+System.Runtime.Serialization.SerializationInfo& info) [0x00000]
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject
+(System.IO.BinaryReader reader) [0x00000]
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph
+(System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result,
+System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000]
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize
+(System.IO.Stream serializationStream,
+System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000]
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
+(System.IO.Stream serializationStream) [0x00000]
+ at Program.Main (System.String[] args) [0x00000]
+
+which is only correct under 1.x
More information about the mono-bugs
mailing list