mail-archives/mono-bugs/2004-June/016811.html

136 строки
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 59638][Blo] New - MONO Beta 2 bug with XmlSerializer member ordering
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:bugzilla-daemon%40bugzilla.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="016810.html">
<LINK REL="Next" HREF="016812.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 59638][Blo] New - MONO Beta 2 bug with XmlSerializer member ordering
</H1>
<B>bugzilla-daemon@bugzilla.ximian.com
</B>
<A HREF="mailto:bugzilla-daemon%40bugzilla.ximian.com"
TITLE="[Mono-bugs] [Bug 59638][Blo] New - MONO Beta 2 bug with XmlSerializer member ordering">bugzilla-daemon@bugzilla.ximian.com
</A><BR>
<I>Sat, 5 Jun 2004 22:24:22 -0400 (EDT)</I>
<P><UL>
<LI> Previous message: <A HREF="016810.html">[Mono-bugs] [Bug 59552][Cri] Changed - Integer overflow in allocating strings
</A></li>
<LI> Next message: <A HREF="016812.html">[Mono-bugs] [Bug 59638][Blo] Changed - MONO Beta 2 bug with XmlSerializer member ordering
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#16811">[ date ]</a>
<a href="thread.html#16811">[ thread ]</a>
<a href="subject.html#16811">[ subject ]</a>
<a href="author.html#16811">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="mailto:davidandrewtaylor@hotmail.com.">davidandrewtaylor@hotmail.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=59638">http://bugzilla.ximian.com/show_bug.cgi?id=59638</A>
--- shadow/59638 2004-06-05 22:24:22.000000000 -0400
+++ shadow/59638.tmp.17005 2004-06-05 22:24:22.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 59638
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity: 001 One hour
+Priority: Blocker
+Component: Sys.XML
+AssignedTo: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+ReportedBy: <A HREF="mailto:davidandrewtaylor@hotmail.com">davidandrewtaylor@hotmail.com</A>
+QAContact: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+TargetMilestone: ---
+URL:
+Cc:
+Summary: MONO Beta 2 bug with XmlSerializer member ordering
+
+I have provided two patches for MONO Beta 2, and given I am not on CVS
+they will either need to be applied manually given the instructions below
+or you can use my &quot;patched&quot; files: XmlTypeMapping.cs and
+XmlReflectionImporter.cs (provided no other changes have been done to
+these classes since Beta2).
+
+BUG PART A:
+There are two bugs in the MONO XmlSerializer regarding ordering of
+serialized members. The first bug is in the XmlReflectionImporter.cs
+file in the follwoing method: &quot;ICollection GetReflectionMembers(Type
+type)&quot;. In the current code there has been an attempt to return members
+in the same order as the MS.NET implementation if a class consisting of
+an inheritance hierarchy is serialized. The code is &quot;almost correct&quot;,
+however differs from the MS.NET implementation if you try to serialize a
+class consisting of both a type hierarchy AND both properties and
+fields. MS.NET serializes starting at the base class (first all base
+class fields, then all base class properties), then proceeds up the
+inheritance hierarchy (first fields, then properties). You can see the
+difference in behavior by running the attached testcase.cs
+
+To correct this bug please replace the entire GetReflectionMembers(Type
+type) method with the replacement method I have
+attached &quot;GetReflectionMembers.txt&quot; in the XmlReflectionImporter.cs file.
+Note: This fix works for both the serialization interpreter and the
+serialization code generator.
+Note: The current SoapReflectionImporter appear to be correct and does
+not require any modifications.
+
+BUG PART B:
+MONO currently does not maintain XML attribute ordering during
+serialization (it uses a hashtable), which is different to MS.NET which
+maintains order. Whilst this is not strictly a bug (as attribute
+ordering should never be assumed), we increase compabilility with MS.NET
+by making a simple change. This change will also ensure that anyone who
+has &quot;hand written&quot; poor quality XML parsers will not have problems when
+they attempt to migrate their web services from MS.NET to MONO.
+
+The fix requires that 3 lines be changed in the XmlTypeMappings.cs file:
+
+- Line 148: Hashtable _attributeMembers;
++ Line 148: System.Collections.Specialized.ListDictionary
+_attributeMembers;
+
+- Line 176: if (_attributeMembers == null) _attributeMembers = new
+Hashtable();
++Line 176: if (_attributeMembers == null) _attributeMembers = new
+System.Collections.Specialized.ListDictionary();
+
+- Line 178 if (_attributeMembers.ContainsKey (key))
++ Line 178 if (_attributeMembers.Contains (key))
+Note: You may want to add &quot;using System.Collections.Specialized;&quot;
+
+Thanks,
+David Taylor
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="016810.html">[Mono-bugs] [Bug 59552][Cri] Changed - Integer overflow in allocating strings
</A></li>
<LI> Next message: <A HREF="016812.html">[Mono-bugs] [Bug 59638][Blo] Changed - MONO Beta 2 bug with XmlSerializer member ordering
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#16811">[ date ]</a>
<a href="thread.html#16811">[ thread ]</a>
<a href="subject.html#16811">[ subject ]</a>
<a href="author.html#16811">[ author ]</a>
</LI>
</UL>
</body></html>