[Mono-bugs] [Bug 74739][Wis] New - Formatters.Soap exception when deserializing PointF serialized with MS.NET

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Apr 2005 12:52:40 -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 davide.morelli@parser.it.

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

--- shadow/74739	2005-04-26 12:52:40.000000000 -0400
+++ shadow/74739.tmp.12334	2005-04-26 12:52:40.000000000 -0400
@@ -0,0 +1,180 @@
+Bug#: 74739
+Product: Mono: Runtime
+Version: 1.1
+OS: Windows XP
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: io-layer
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davide.morelli@parser.it               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Formatters.Soap exception when deserializing PointF serialized with MS.NET
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. write this file
+
+---------------------------begin of file testBugPointF.cs
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters;
+//using System.Runtime.Serialization.Formatters.Binary;
+using System.Runtime.Serialization.Formatters.Soap;
+using System.Drawing;
+
+namespace testSerializza1
+{
+   public class HelloWorld
+   {
+      public static void Main(string[] args)
+      {
+		if (args[0]=="save")
+		 salvalo("test" + args[1]);
+		if (args[0]=="load")
+		 caricalo("test" + args[1]);
+      }
+	  
+		public static void salvalo(string filename)
+		{
+			Stream myStream = null;
+			myStream  = new FileStream(filename, 
+FileMode.Create);
+			if (myStream != null)
+			{
+				SoapFormatter formatter = new 
+SoapFormatter();
+				//BinaryFormatter formatter = new 
+BinaryFormatter();
+				formatter.AssemblyFormat = 
+FormatterAssemblyStyle.Simple;
+				PointF test = new PointF(0f, 0f); 
+				//Documento doc = new Documento(10,10);
+				formatter.Serialize(myStream, test);
+				Console.WriteLine("bool = " + 
+test.ToString());
+				myStream.Close();
+			}
+		}
+
+		public static void caricalo(string file)
+		{
+			string filename = "";
+			Stream myStream = null;
+
+			try
+			{
+				filename = file;
+				myStream = File.Open(file, FileMode.Open, 
+FileAccess.Read, FileShare.None);
+			}
+			catch (Exception ex)
+			{
+				myStream.Close();
+				Console.WriteLine("erroreOpen: " + 
+ex.Message);
+			}
+			try
+			{
+				
+				if (myStream != null)
+				{
+					Console.WriteLine("ho letto dal 
+file: " + filename);
+
+					SoapFormatter formatter = new 
+SoapFormatter();
+					//BinaryFormatter formatter = new 
+BinaryFormatter();
+
+					formatter.AssemblyFormat = 
+FormatterAssemblyStyle.Simple;
+
+
+					PointF test = (PointF) 
+formatter.Deserialize(myStream);
+					Console.WriteLine("PointF = " + 
+test.ToString());
+
+					myStream.Close();
+
+				}
+			} 
+			catch (Exception ex)
+			{
+				myStream.Close();
+				Console.WriteLine("error: " + ex.ToString
+());
+			}
+		}
+   } 
+}
+
+---------------------------- end of file testBugPointF.cs
+
+
+2. compile it on OSX
+ mcs testBugPointF.cs -
+r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Drawing.dll
+
+3. serialize a PointF by:
+mono testBugPointF.exe save MONO
+
+4. copy testBugPointF.exe and testMONO on windows
+
+5. try to deserialize a Pointf with MS.NET
+testBugPointF.exe load MONO
+
+
+Actual Results:
+
+error: System.Runtime.Serialization.SerializationException: Impossibile 
+trovare il membro 'System.Drawing.PointF cx'.
+   at System.Runtime.Serialization.Formatters.Soap.ReadObjectInfo.Position
+(String name)
+   at System.Runtime.Serialization.Formatters.Soap.ReadObjectInfo.GetType
+(String name)
+   at 
+System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseMember
+(ParseRecord pr)
+   at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse
+(ParseRecord pr)
+   at System.Runtime.Serialization.Formatters.Soap.SoapHandler.EndElement
+(String prefix, String name
+, String urn)
+   at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXml()
+   at System.Runtime.Serialization.Formatters.Soap.SoapParser.Run()
+   at 
+System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize
+(HeaderHandler handler, I
+SerParser serParser)
+   at 
+System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize
+(Stream serializationStr
+eam, HeaderHandler handler)
+   at 
+System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize
+(Stream serializationStr
+eam)
+   at testSerializza1.HelloWorld.caricalo(String file)
+
+
+Expected Results:
+{X=0, Y=0}
+
+How often does this happen? 
+always
+
+Additional Information:
+bug present also when serializing on MS.NET and deserializing on MONO