[Mono-dev] [Mono-patches] r109263 - trunk/mcs/class/System.Data/System.Data

Rodrigo Kumpera kumpera at gmail.com
Wed Jul 30 10:26:36 EDT 2008


Varadhan,

Depending on exception on regular paths might lead to disastrous
performance.
Is this just a corner case for compatibility or this kind of situation might
happen often?
We might need to document this shortcoming of our stack.

Thanks,
Rodrigo


On Wed, Jul 30, 2008 at 10:56 AM, Veerapuram Varadhan (vvaradhan at novell.com)
<mono-patches-list at lists.ximian.com> wrote:

> Author: varadhan
> Date: 2008-07-30 09:56:01 -0400 (Wed, 30 Jul 2008)
> New Revision: 109263
>
> Modified:
>   trunk/mcs/class/System.Data/System.Data/ChangeLog
>   trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs
> Log:
> Fixes##377146 - handle custom reference types sanely when reading from
> an XML file
>
>
> Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
> ===================================================================
> --- trunk/mcs/class/System.Data/System.Data/ChangeLog   2008-07-30 13:40:00
> UTC (rev 109262)
> +++ trunk/mcs/class/System.Data/System.Data/ChangeLog   2008-07-30 13:56:01
> UTC (rev 109263)
> @@ -1,3 +1,8 @@
> +2008-07-29  Veerapuram Varadhan  <vvaradhan at novell.com>
> +
> +       Fixes ##377146
> +       * XmlDataReader.cs (ReadElementElement): Handle custom reference
> types sanely.
> +
>  2008-07-20  Gert Driesen  <drieseng at users.sourceforge.net>
>
>        * DataColumnCollection.cs (IndexOf): Include name of column - for
> which
>
> Modified: trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs
> ===================================================================
> --- trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs    2008-07-30
> 13:40:00 UTC (rev 109262)
> +++ trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs    2008-07-30
> 13:56:01 UTC (rev 109263)
> @@ -26,6 +26,7 @@
>  using System.IO;
>  using System.Data;
>  using System.Xml;
> +using System.Xml.Serialization;
>
>
>  namespace System.Data
> @@ -297,7 +298,27 @@
>
>                                bool wasEmpty = reader.IsEmptyElement;
>                                int depth = reader.Depth;
> -                               row [col] = StringToObject (col.DataType,
> reader.ReadElementString ());
> +
> +                               if (typeof
> (IXmlSerializable).IsAssignableFrom (col.DataType)) {
> +#if NET_2_0
> +                                       try {
> +                                               // NOTE: ReadElementString
> works fine with proper XML with CDATA etc,
> +                                               // however doesn't behave
> well with XMLs like the one in
> +                                               //
> https://bugzilla.novell.com/show_bug.cgi?id=377146 which is
> +                                               // apparently supported by
> MS.NET - to maintain compatibility,
> +                                               // Try reading the element
> content as an object type
> +                                               row [col] =
> reader.ReadContentAsObject ();
> +                                       } catch {
> +#endif
> +                                               // XML is not in accordance
> to expected standards, try reading the content as an xml doc
> +                                               row [col] =
> reader.ReadInnerXml ();
> +#if NET_2_0
> +                                       }
> +#endif
> +                               } else {
> +                                       row [col] = StringToObject
> (col.DataType, reader.ReadElementString ());
> +                               }
> +
>                                if (!wasEmpty && reader.Depth > depth) {
>                                // This means, instance does not match with
>                                // the schema (because the instance element
>
> _______________________________________________
> Mono-patches maillist  -  Mono-patches at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-patches
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080730/5c01ab99/attachment-0001.html 


More information about the Mono-devel-list mailing list