[Mono-bugs] [Bug 73020][Nor] New - Copying a DataTable with DataTable.Copy() fails on Mono 1.1.4
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 25 Feb 2005 06:37:08 -0500 (EST)
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 dfreund@runlevel-5.org.
http://bugzilla.ximian.com/show_bug.cgi?id=73020
--- shadow/73020 2005-02-25 06:37:08.000000000 -0500
+++ shadow/73020.tmp.28956 2005-02-25 06:37:08.000000000 -0500
@@ -0,0 +1,177 @@
+Bug#: 73020
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dfreund@runlevel-5.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Copying a DataTable with DataTable.Copy() fails on Mono 1.1.4
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Some days back I upgraded from 1.1.3 to 1.1.4 on SLES9
+Since having done so, I get the following error in my code (works ok on
+1.1.3 and M$.NET) when trying to copy a DataTable using the
+DataTable.Copy()-Method:
+
+Unhandled Exception: System.ArgumentException: Cannot set MaxLength property
+on 'NAVI_NODE_text' column which is mapped to SimpleContent.
+in <0x00058> System.Data.DataColumn:set_MaxLength (int)
+in <0x000f0> System.Data.DataTable:CopyColumn (System.Data.DataColumn)
+in <0x002fb> System.Data.DataTable:CopyProperties (System.Data.DataTable)
+in <0x00046> System.Data.DataTable:Clone ()
+in <0x0001e> System.Data.DataTable:Copy ()
+in <0x0035e> DataTableTest.MainClass:Main (string[])
+
+I have attached a simple test case including a simplified schema and
+xml-file which again works on MS.NET but not on Mono 1.1.4.
+
+Steps to reproduce the problem:
+1. Copy the schema, the xml-file and the class file to a directory of
+choice (TM)
+2. compile class: mcs -r:System.Data Main.cs
+3. run and enjoy error message
+
+Actual Results:
+Throws System.ArgumentException on Mono 1.1.4 but not on M$.NET or Mono 1.1.3
+
+Expected Results:
+Listing of data copied to DataTable by Copy()-method
+
+How often does this happen?
+every time
+
+Additional Information:
+Example files:
+Main.cs:
+========
+using System;
+using System.Data;
+
+namespace DataTableTest
+{
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ DataSet ds = new DataSet();
+ ds.ReadXmlSchema("schema.xsd");
+ ds.ReadXml("data.xml");
+
+ foreach (DataTable t in ds.Tables)
+ {
+ Console.WriteLine("\n--->" + t.TableName);
+ foreach (DataColumn c in t.Columns)
+ Console.Write("{0,12} | ", c.ColumnName);
+ }
+
+ Console.WriteLine();
+ DataTable dt = ds.Tables["NAVI_NODE"].Copy();
+
+ foreach (DataRow r in dt.Rows)
+ {
+ foreach (DataColumn c in dt.Columns)
+ Console.Write("{0,12} | ", r[c.ColumnName]);
+ Console.WriteLine();
+ }
+ }
+ }
+}
+
+
+schema.xsd
+==========
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema elementFormDefault="qualified"
+attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="USER_INFO">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="FST_NAME">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="30"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="LST_NAME">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="0"/>
+ <xs:maxLength value="30"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="NAVI_NODES">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="NAVI_NODE" minOccurs="0"
+maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:positiveInteger">
+ <xs:attribute name="parent_id"
+type="xs:positiveInteger" use="optional"/>
+ <xs:attribute name="name" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="40"/>
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="frame" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="15"/>
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="z_order"
+type="xs:positiveInteger" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+
+
+data.xml
+========
+<?xml version="1.0" encoding="utf-8"?>
+<USER_INFO xmlns:xs="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <FST_NAME>Arthur</FST_NAME>
+ <LST_NAME>Dent</LST_NAME>
+ <NAVI_NODES>
+ <NAVI_NODE name="home" frame="welcome" z_order="6">3</NAVI_NODE>
+ <NAVI_NODE name="options" frame="none" z_order="7">85</NAVI_NODE>
+ <NAVI_NODE parent_id="3" name="list" frame="list"
+z_order="12">41</NAVI_NODE>
+ <NAVI_NODE parent_id="3" name="detail" frame="detail"
+z_order="14">82</NAVI_NODE>
+ <NAVI_NODE parent_id="85" name="prefs" frame="prefs"
+z_order="1">87</NAVI_NODE>
+ <NAVI_NODE parent_id="85" name="help" frame="help"
+z_order="2">89</NAVI_NODE>
+ </NAVI_NODES>
+</USER_INFO>