[Mono-bugs] [Bug 77501][Nor] New - Numeric value for enum is
serialized as primitive type
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Feb 8 09:55:15 EST 2006
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 gert.driesen at pandora.be.
http://bugzilla.ximian.com/show_bug.cgi?id=77501
--- shadow/77501 2006-02-08 09:55:15.000000000 -0500
+++ shadow/77501.tmp.12870 2006-02-08 09:55:15.000000000 -0500
@@ -0,0 +1,60 @@
+Bug#: 77501
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com
+ReportedBy: gert.driesen at pandora.be
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Numeric value for enum is serialized as primitive type
+
+The numeric value of an enum constant is wrongly serialized as as
+primitive type (xsi type).
+
+This is a simple bug, but I need to get this to behave like the MSFT
+implementation before I can add additional unit tests for
+System.Xml.Serialization. This is why I didn't set the priority
+to "Minor".
+
+To reproduce, compile and run the following code snippet:
+
+using System;
+using System.Xml.Serialization;
+
+public class Test
+{
+ static void Main ()
+ {
+ XmlSerializer xs = new XmlSerializer (typeof (EnumDefaultValueNF));
+ xs.Serialize (Console.Out, (int) EnumDefaultValueNF.e1);
+ }
+ public enum EnumDefaultValueNF { e1 = 1, e2 = 2, e3 = 3 }
+}
+
+Actual result:
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<EnumDefaultValueNF xmlns:q1="http://www.w3.org/2001/XMLSchema"
+d1p1:type="q1:int" xmlns:d1p1="http://www.w3.org/2001/XMLSchema-
+instance">1</EnumDefaultValueNF>
+
+Expected result:
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<EnumDefaultValueNF>1</EnumDefaultValueNF>
+
+Note: we should in fact get this, but I'll file a separate bug report for
+that:
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<EnumDefaultValueNF>e1</EnumDefaultValueNF>
+
+(note that the constant name is output, not its integral value)
More information about the mono-bugs
mailing list