Add workaround for XmlSchema serialization.
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 2 Feb 2015 10:36:07 +0000 (18:36 +0800)
committerMarek Safar <marek.safar@gmail.com>
Mon, 2 May 2016 22:07:55 +0000 (00:07 +0200)
Somewhere in System.Xml requires NameTable to be canonically reused when
deserializing XmlSchema, so that certain deserialization part can check
only reference equality.

Since we have hybrid System.Xml implementation for XmlSerializer, this
is not completely achieved and with reference comparison it causes some
schema deserialization failure. To avoid this problem, just disable
reference comparison. It should not affect outside XmlSchema serialization.

mcs/class/referencesource/System.Xml/System/Xml/Schema/SchemaNames.cs

index fb87652be3ec36752a95385a5d99336437c47d2e..6ca87fd757bd5d21bd8e2dcfcc056a89c1e1a85f 100644 (file)
@@ -461,11 +461,15 @@ namespace System.Xml.Schema {
         }
 
         public bool IsXSDRoot(string localName, string ns) {
-            return Ref.Equal(ns, NsXs) && Ref.Equal(localName, XsdSchema);
+            // FIXME: due to some implementation glitch, SchemaNames are not fully used in mono yet.
+            // return Ref.Equal(ns, NsXs) && Ref.Equal(localName, XsdSchema);
+            return localName == XsdSchema && ns == NsXs;
         }
 
         public bool IsXDRRoot(string localName, string ns) {
-            return Ref.Equal(ns, NsXdr) && Ref.Equal(localName, XdrSchema);
+            // FIXME: due to some implementation glitch, SchemaNames are not fully used in mono yet.
+            // return Ref.Equal(ns, NsXdr) && Ref.Equal(localName, XdrSchema);
+            return localName == XdrSchema && ns == NsXdr;
         }
 
         public XmlQualifiedName GetName(SchemaNames.Token token) {