[Mono-bugs] [Bug 73114][Nor] Changed - Serialization/deserialization incompatibilities between Mono and .NET

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 1 Mar 2005 06:56:40 -0500 (EST)


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 dezelin@gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=73114

--- shadow/73114	2005-03-01 06:34:51.000000000 -0500
+++ shadow/73114.tmp.6623	2005-03-01 06:56:40.000000000 -0500
@@ -70,6 +70,102 @@
 deserialization code to try tracing this bug by myself. If you take a
 look at the class Report, you'll see that it uses custom
 serialization/deserialization for making serialized objects smaller.
 Based on class fields, our custom serializer skips some values. We
 store those binary files (from the file templates.tar.bz2) as fields
 in Sql server and load/deserialize them when we need to print a report.
+
+------- Additional Comments From dezelin@gmail.com  2005-03-01 06:56 -------
+You may try with this simpler testcase:
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+
+using Informatika.Infos.Foundation.Report;
+
+namespace BBB
+{
+	public class Download
+	{
+		public static void Main(string[] args)
+		{
+			FileStream fs = new FileStream(args[0], FileMode.Open);
+			BinaryFormatter bf = new BinaryFormatter();
+			bf.Binder = new ReportBinder();
+			Report r = (Report)bf.Deserialize(fs);
+		}
+	}
+}
+
+
+mono --debug bf-bug.exe ./templates/CashFlowRExe.Dat
+
+This is the exception trace:
+
+Unhandled Exception:
+System.Runtime.Serialization.SerializationException: Unexpected binary
+element: 3
+in [0x00178] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:216)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObject
+(BinaryElement element, System.IO.BinaryReader reader, System.Int64
+objectId, System.Object value,
+System.Runtime.Serialization.SerializationInfo info)
+in [0x0005a] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:526)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadValue
+(System.IO.BinaryReader reader, System.Object parentObject, Int64
+parentObjectId, System.Runtime.Serialization.SerializationInfo info,
+System.Type valueType, System.String fieldName,
+System.Reflection.MemberInfo memberInfo, System.Int32[] indices)
+in [0x0007e] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:259)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObjectContent
+(System.IO.BinaryReader reader,
+System.Runtime.Serialization.Formatters.Binary.TypeMetadata metadata,
+Int64 objectId, System.Object objectInstance,
+System.Runtime.Serialization.SerializationInfo info)
+in [0x0001b] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:231)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObjectInstance
+(System.IO.BinaryReader reader, Boolean isRuntimeObject, System.Int64
+objectId, System.Object value,
+System.Runtime.Serialization.SerializationInfo info)
+in [0x0007e] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:156)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObject
+(BinaryElement element, System.IO.BinaryReader reader, System.Int64
+objectId, System.Object value,
+System.Runtime.Serialization.SerializationInfo info)
+in [0x000ea] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:184)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObject
+(BinaryElement element, System.IO.BinaryReader reader, System.Int64
+objectId, System.Object value,
+System.Runtime.Serialization.SerializationInfo info)
+in [0x00034] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:124)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadNextObject
+(System.IO.BinaryReader reader)
+in [0x00045] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:105)
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObjectGraph
+(System.IO.BinaryReader reader, Boolean readHeaders, System.Object
+result, System.Runtime.Remoting.Messaging.Header[] headers)
+in [0x0007f] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:163)
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Deserialize
+(System.IO.Stream serializationStream,
+System.Runtime.Remoting.Messaging.HeaderHandler handler)
+in [0x00003] (at
+/home/skynet/farm/mono-trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:127)
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Deserialize
+(System.IO.Stream serializationStream)
+in [0x0001d] (at
+/home/skynet/work/c#/bf-bug/src/bf-bug/Download.cs:19)
+BBB.Download:Main (System.String[] args)
+
+File 'CashFlowRExe.Dat' is in the attached templates.tar.bz2
+