2009-07-22 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 22 Jul 2009 08:21:30 +0000 (08:21 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 22 Jul 2009 08:21:30 +0000 (08:21 -0000)
* XmlFormatterDeserializer.cs : when reading empty primitive value,
  make sure to consume the reader. Fixed bug #524083.

* XmlObjectSerializerTest.cs : add test for bug #524083, by
  Rolf Bjarne Kvinge.

svn path=/trunk/mcs/; revision=138367

mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/ChangeLog
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs

index c4fd3308837313ece1846c1cddbf104b93ea54a5..1973449a5a97c3dfaa39126f0201cc86f7ac42b0 100755 (executable)
@@ -1,3 +1,8 @@
+2009-07-22  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XmlFormatterDeserializer.cs : when reading empty primitive value,
+         make sure to consume the reader. Fixed bug #524083.
+
 2009-07-22  Atsushi Enomoto  <atsushi@ximian.com>
 
        * SerializationMap.cs : call MoveToContent() before examining
index e6eae077a45ae8e0e73138c704f9c890b3eab9c1..1659a2463ed871d090a5012a87dfd74f5169ac3f 100644 (file)
@@ -147,6 +147,7 @@ namespace System.Runtime.Serialization
                        if (KnownTypeCollection.GetPrimitiveTypeFromName (graph_qname.Name) != null) {
                                string value;
                                if (reader.IsEmptyElement) {
+                                       reader.Read (); // advance
                                        if (type.IsValueType)
                                                return Activator.CreateInstance (type);
                                        else
index c5fcedb56af6b5523a3170d87bb20692072327f8..855c4d5837506ff806194a31ef5268066cd6d15c 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-22  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XmlObjectSerializerTest.cs : add test for bug #524083, by
+         Rolf Bjarne Kvinge.
+
 2009-07-22  Atsushi Enomoto  <atsushi@ximian.com>
 
        * XmlObjectSerializerTest.cs : now we can make xml indented as
index cf49a89d7913ae579e8ea03225ac6e892ad5f42d..dffddd99862ee89995cbfcb013d9436624ae16a1 100644 (file)
@@ -1224,6 +1224,18 @@ namespace MonoTests.System.Runtime.Serialization
                        }
                }
 
+               [Test]
+               public void Bug524083 ()
+               {
+                       string xml = @"
+<AsxEntryInfo xmlns='http://example.com/schemas/asx'>
+       <AdvertPrompt/>
+</AsxEntryInfo>";
+                                               
+                       using (XmlReader reader = XmlReader.Create (new StringReader (xml)))
+                               new DataContractSerializer(typeof (AsxEntryInfo)).ReadObject (reader);
+               }
+               
                private T Deserialize<T> (string xml)
                {
                        return Deserialize<T> (xml, typeof (T));
@@ -1545,4 +1557,9 @@ public class PartDummyEntryInfo : DummyEntryInfo
     public PartDummyEntryInfo() {}
 }
 
-
+[DataContract(Namespace="http://example.com/schemas/asx")]
+public class AsxEntryInfo
+{
+    [DataMember]
+    public string AdvertPrompt { get; set; }
+}