[Mono-bugs] [Bug 77159][Maj] New - XmlSerializer change causes
exceptions with read-only ArrayLists
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Jan 4 13:13:04 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 joeshaw at novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77159
--- shadow/77159 2006-01-04 13:13:04.000000000 -0500
+++ shadow/77159.tmp.30581 2006-01-04 13:13:04.000000000 -0500
@@ -0,0 +1,54 @@
+Bug#: 77159
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com
+ReportedBy: joeshaw at novell.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: XmlSerializer change causes exceptions with read-only ArrayLists
+
+In r54043, Lluis committed a change with the following ChangeLog entry:
+
+ 2005-12-07 Lluis Sanchez Gual <lluis at novell.com>
+
+ * XmlSerializationReaderInterpreter.cs: When deserializing a "flat"
+ collection, don't create a new collection if the property already
+has a
+ collection instance.
+ * SerializationCodeGenerator.cs: same as above. Also return an empty
+ string for flag enum default values.
+
+This has the side effect of causing deserialization to fail when you
+have code similar to this:
+
+ private ArrayList myfoo = new ArrayList ();
+
+ [XmlArray]
+ [XmlArrayItem (ElementName="Foo", Type=typeof (string))]
+ public ArrayList MyFoo {
+ get { return ArrayList.ReadOnly (myfoo); }
+ set { myfoo = value; }
+ }
+
+You'll end up getting a NotSupportException from
+System.Collections.ArrayList+FixedSideArrayListWrapper:Add(), because
+the code is now trying to add to an existing list rather than setting it
+to a newly created one.
+
+Seeing as the side effects of doing a property get and then Add() can be
+quite different than doing a property set, shouldn't this always do a
+property set?
+
+I'm not sure if the behavior we're doing in Beagle is correct, but we've
+been relying on it for a long time. I don't have access to a windows
+box to test the behavior, and Lluis's changelog entry doesn't seem to
+imply that the change was for consistency.
More information about the mono-bugs
mailing list