[Mono-bugs] [Bug 74738][Nor] New - Formatters.Soap serialization of bool is different in MS.NET and MONO
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Apr 2005 12:41:01 -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=74738
--- shadow/74738 2005-04-26 12:41:01.000000000 -0400
+++ shadow/74738.tmp.12206 2005-04-26 12:41:01.000000000 -0400
@@ -0,0 +1,182 @@
+Bug#: 74738
+Product: Mono: Runtime
+Version: 1.1
+OS: Mac OS X 10.3
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: io-layer
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: davide.morelli@parser.it
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Formatters.Soap serialization of bool is different in MS.NET and MONO
+
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. write this file on OSX
+
+---------------------- begin file testBugSoap.cs
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters;
+using System.Runtime.Serialization.Formatters.Soap;
+
+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;
+ bool test = true;
+ //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;
+
+
+ bool test = (bool)
+formatter.Deserialize(myStream);
+ Console.WriteLine("bool = " +
+test.ToString());
+
+ myStream.Close();
+
+ }
+ }
+ catch (Exception ex)
+ {
+ myStream.Close();
+ Console.WriteLine("error: " + ex.ToString
+());
+ }
+ }
+ }
+}
+
+-------------------------- end of file
+
+
+2. compile it with
+mcs testBugSoap.cs -r:System.Runtime.Serialization.Formatters.Soap.dll
+
+3. serialize a bool with
+mono testBugSoap save MONO
+
+4. copy the program and the file "testMONO" on windows
+
+5. deserialize a bool on MS.NET:
+testBugSoap load MONO
+
+Actual Results:
+
+error: System.ArgumentNullException: Il valore non puņ essere null.
+Nome parametro: format
+ at System.String.Format(IFormatProvider provider, String format, Object
+[] args)
+ at System.String.Format(String format, Object arg0, Object arg1)
+ at System.Runtime.Serialization.Formatters.Soap.Converter.FromString
+(String value, InternalPrimit
+iveTypeE code)
+ 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)
+
+C:\Progetti\DECO backups e progetti secondari\Mono\vecchi>
+
+
+Expected Results:
+True
+
+How often does this happen?
+always
+
+Additional Information:
+
+viceversa works ok: Mono deserializes bool serialized with MS.NET
+
+looking at the xml file you'll see that MONO writes True instead of true
+(first letter capitalized) this throws exception on MS.NET