[Mono-bugs] [Bug 57186][Nor] New - decimals are serialized wrong in bniray serialization
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 18 Apr 2004 08:32:45 -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 mono-devel01@foobarquarium.de.
http://bugzilla.ximian.com/show_bug.cgi?id=57186
--- shadow/57186 2004-04-18 08:32:45.000000000 -0400
+++ shadow/57186.tmp.23741 2004-04-18 08:32:45.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 57186
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mono-devel01@foobarquarium.de
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: decimals are serialized wrong in bniray serialization
+
+Description of Problem:
+Mono writes decimal values as 16 byte binary data for object inlined
+primitive data types. This is not readable by MS.NET as they are writing
+the value as string.
+
+Steps to reproduce the problem:
+1. compile and execute example code on MS.NET and Mono
+
+Actual Results:
+failure of MS.NET to deserialize a Mono file and the other way arround.
+
+Additional Information:
+try the following code:
+
+using System;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+
+[Serializable]
+class DecTest {
+ public decimal decimalValue = 8;
+ public decimal decimalValu = 123.456;
+ public decimal decimalVale = 9876.54321;
+}
+
+public class Writer {
+ public static void Main(string[] args) {
+ FileStream rfs;
+ BinaryFormatter formatter;
+ DecTest a;
+
+ if(args.Length == 0) {
+ a = new DecTest();
+ rfs = File.Create("Decimal.ser");
+ formatter = new BinaryFormatter();
+ formatter.Serialize(rfs, a);
+ rfs.Close();
+ } else {
+ rfs = File.OpenRead(args[0]);
+ formatter = new BinaryFormatter();
+ a = (DecTest) formatter.Deserialize(rfs);
+ rfs.Close();
+
+ Console.WriteLine(a.ToString());
+ }
+ }
+}