[Mono-bugs] [Bug 650823] New: Duplicate row ConstraintException thrown in Index incorrectly - fix/test included

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 2 16:57:44 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=650823

https://bugzilla.novell.com/show_bug.cgi?id=650823#c0


           Summary: Duplicate row ConstraintException thrown in Index
                    incorrectly - fix/test included
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cvolzke at live.com.au
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5

The fix is:

int oldIdx = FindIndexExact (oldRecord);
if (oldIdx == -1) {
  if (FindIndexExact(newRecord) == -1)  // <---- add this line, done
      Add(row, newRecord);
  return;
}

Test case below


Reproducible: Always

Steps to Reproduce:
Test case:

            DataTable table = new DataTable("table");
            DataColumn column = table.Columns.Add("key", typeof(int));
            table.PrimaryKey = new DataColumn[] { column }; // this will create
an index on 'key'
            DataRow row1 = table.Rows.Add(1);
            row1.BeginEdit();

            DataView view = new DataView(table);
            view.Sort = "key"; // the index on 'key' will be updated
            int count = view.Count;

            DataRow row2 = table.Rows.Add(2);
            row2.AcceptChanges();
            row1.EndEdit(); // http://www.youtube.com/watch?v=xRwR-li5t_A

-- 
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