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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 12 Jun 2004 01:41:02 -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 davidandrewtaylor@hotmail.com.

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

--- shadow/51853	2004-06-12 01:41:02.000000000 -0400
+++ shadow/51853.tmp.11039	2004-06-12 01:41:02.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 51853
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: VERIFIED   
+Resolution: NOTABUG
+Severity: Unknown
+Priority: Normal
+Component: Sys.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).
+
+------- Additional Comments From ginga@kit.hi-ho.ne.jp  2003-12-08 04:48 -------
+As a general XML rule, attribute order is meaningless (see XML 
+InfoSet specification). It is not interoperability problem. You 
+should not rely on it.
+
+------- Additional Comments From davidandrewtaylor@hotmail.com  2004-06-12 01:41 -------
+For the record: as of Beta 3 this has been fixed based on bug report 
+59638 which included maintaining both Element and Attribute 
+ordering.  Thanks Lluis!