[Mono-bugs] [Bug 644418] New: DataTable clone fails

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 6 21:15:42 EDT 2010



           Summary: DataTable clone fails
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: i386
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: peter.figuli at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
Gecko/20100914 Firefox/3.6.10 ( .NET CLR 3.5.30729; .NET4.0E)

public virtual DataTable Clone () creates a new instance with Activator and
than calls CopyProperties(). 
Code tries to copy all properties from old instance to new one, but if you
clone DataSet generated table, you end up with: "System.ArgumentException: Key
duplication when adding: typedName."

So in code it needs one more condition:

for (int i=0; i < ExtendedProperties.Count; i++)
  if (!Copy.ExtendedProperties.Contains(tgtArray.GetValue (i))
    Copy.ExtendedProperties.Add (tgtArray.GetValue (i),
ExtendedProperties[tgtArray.GetValue (i)]);

Reproducible: Always

Steps to Reproduce:
1.Create DataTable
2. Add typedName into ExtendetedProperties
3. do table.Clone()
Actual Results:  

Expected Results:  
to have a clone

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list