[Mono-bugs] [Bug 59250][Nor] New - incompatible serialization/deserialization of System.Guid class between ms.net and mono using BinaryFormatter

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 28 May 2004 11:52:16 -0400 (EDT)


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 robik@mailbox.sk.

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

--- shadow/59250	2004-05-28 11:52:16.000000000 -0400
+++ shadow/59250.tmp.14883	2004-05-28 11:52:16.000000000 -0400
@@ -0,0 +1,98 @@
+Bug#: 59250
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: robik@mailbox.sk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: incompatible serialization/deserialization of System.Guid class between ms.net and mono using BinaryFormatter
+
+Description of Problem:
+
+incompatible serialization/deserialization of System.Guid class between 
+ms.net and mono using BinaryFormatter
+
+Steps to reproduce the problem:
+
+using System;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace GuidTest
+{
+	class GuidTest
+	{
+		const string filename = "guid.bin";
+		static void Main(string[] args)
+		{
+			BinaryFormatter f = new BinaryFormatter();
+			if(File.Exists(filename))
+			{
+				Guid guid = (Guid)f.Deserialize(new 
+FileStream(filename, FileMode.Open));
+				Console.WriteLine(guid.ToString());
+				Console.ReadLine();
+			}
+			else
+			{
+				f.Serialize(new FileStream(filename, 
+FileMode.CreateNew), Guid.Empty);
+			}
+		}
+	}
+}
+
+
+
+1. Run program under ms.net (generate guid.bin file)
+2. Run program under mono (using generated guid.bin file)
+
+Actual Results:
+
+Unhandled Exception: System.Runtime.Serialization.SerializationException: 
+Field "_a" not found in class System.Guid
+in <0x0060f> 
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadTypeMetadat
+a (System.IO.BinaryReader,bool)
+in <0x00047> 
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObjectInsta
+nce 
+(System.IO.BinaryReader,bool,long&,object&,System.Runtime.Serialization.Ser
+ializationInfo&)
+in <0x00069> 
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObject 
+(System.Runtime.Serialization.Formatters.Binary.BinaryElement,System.IO.Bin
+aryReader,long&,object&,System.Runtime.Serialization.SerializationInfo&)
+in <0x0007d> 
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadNextObject 
+(System.IO.BinaryReader)
+in <0x000b9> 
+System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObjectGraph
+ 
+(System.IO.BinaryReader,bool,object&,System.Runtime.Remoting.Messaging.Head
+er[]&)
+in <0x00192> 
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Deserialize 
+(System.IO.Stream,System.Runtime.Remoting.Messaging.HeaderHandler)
+in <0x00017> 
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Deserialize 
+(System.IO.Stream)
+in <0x00096> GuidTest.GuidTest:Main (string[])
+ 
+
+Expected Results:
+
+00000000-0000-0000-0000-000000000000
+
+How often does this happen? 
+
+always