[Mono-bugs] [Bug 77159][Maj] Changed - XmlSerializer change causes exceptions with read-only ArrayLists

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jan 5 14:36:36 EST 2006


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 atsushi at ximian.com.

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

--- shadow/77159	2006-01-05 13:56:57.000000000 -0500
+++ shadow/77159.tmp.26111	2006-01-05 14:36:36.000000000 -0500
@@ -57,6 +57,39 @@
 familiar with xml serialization code).
 
 ------- Additional Comments From joeshaw at novell.com  2006-01-05 13:56 -------
 Created an attachment (id=16284)
 test case
 
+
+------- Additional Comments From atsushi at ximian.com  2006-01-05 14:36 -------
+The same error happens under MS.NET (both 1.x and 2.0).
+
+$ ./77159.exe
+
+Unhandled Exception: System.InvalidOperationException: There is an
+error in XML
+document (5, 6). ---> System.NotSupportedException: Collection is
+read-only.
+   at System.Collections.ReadOnlyArrayList.Add(Object obj)
+   at
+Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
+1_X(Boolean isNullable, Boolean checkType)
+   at
+Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
+4_X()
+   --- End of inner exception stack trace ---
+   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
+xmlReader, St
+ring encodingStyle, XmlDeserializationEvents events)
+   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
+xmlReader, Xm
+lDeserializationEvents events)
+   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
+   at Test.Main()
+
+
+Seeing both test code and the result above, I noticed that
+XmlSerializable members should not be read-only. You should not return
+read-only collections for serializable collections.
+
+So, I don't think it is a bug, but let's wait for Lluis.


More information about the mono-bugs mailing list