[Mono-bugs] [Bug 51853][Nor] New - MONO XML Serializer Attribute Ordering Bug

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 8 Dec 2003 01:58:23 -0500 (EST)


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 davidandrewtaylor@hotmail.com.

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

--- shadow/51853	2003-12-08 01:58:23.000000000 -0500
+++ shadow/51853.tmp.27572	2003-12-08 01:58:23.000000000 -0500
@@ -0,0 +1,72 @@
+Bug#: 51853
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MONO XML Serializer Attribute Ordering Bug
+
+Description of Problem:
+The MONO XmlSerializer does not appear to maintain the predictable field
+ordering as used by the MS.NET implementation.  Note that with MS.NET
+fields are converted to attributes in the same order as they appear in the
+class.
+
+Steps to reproduce the problem:
+1. Here are the classes I am trying to serialize:
+    [XmlTypeAttribute(Namespace="http://tempuri.org")]
+    public enum Avail {                                                   
+                            
+        n,                                                                
+               
+        y,
+    }
+
+    [XmlTypeAttribute(Namespace="http://tempuri.org/")]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(AvailResponse))]
+    public abstract class Response {                                      
+                                         
+        [XmlAttribute] public string name;
+    }
+
+    /// <remarks/>
+    [XmlTypeAttribute(Namespace="http://tempuri.org")]
+    public class AvailResponse : Response {                               
+                                                
+        [XmlAttribute] public Avail com;                                  
+                                             
+        [XmlAttribute] public Avail net;                                  
+                                             
+        [XmlAttribute] public Avail org;
+        [XmlAttribute] public Avail biz;                                  
+                                             
+        [XmlAttribute] public Avail info;                                 
+                                              
+        [XmlAttribute] public Avail us;
+    }
+
+2. Use the XML Serializer to convert to a string.
+
+Actual Results:
+<AvailResponse info="y" name="jmaximianoadvogados" us="y" org="y" biz="y"
+net="y" com="n" />
+
+Expected Results:
+<AvailResponse name="jmaximianoadvogados" com="n" net="y" org="y" biz="y"
+info="y" com="n" />
+
+Additional Information:
+The output when run using MS.NET is to serialize the fields in the same
+order as they appear in the class.  The MONO XmlSerializer seems to output
+in a different less predictable order (which could lead to interoperability
+problems).