Bug 5897 - DataSet.EnforceConstraint throws an exception due to deleted rows
Summary: DataSet.EnforceConstraint throws an exception due to deleted rows
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
Depends on:
Reported: 2012-06-27 20:35 UTC by Dominique NORMAND
Modified: 2012-06-27 22:14 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dominique NORMAND 2012-06-27 20:35:30 UTC
For a DataSet that has a Relation between 2 DataTables and some rows in one of those 2 DataTables have a status of deleted, the DataSet throws an exception when enforcing the constraints.

Here's a sample code to reproduce the defect

DataSet 	ds = new DataSet() ;
DataTable 	t1 = ds.Tables.Add("T1") ;
DataTable 	t2 = ds.Tables.Add("T2") ;
DataColumn 	c1 = t1.Columns.Add("C1") ;
DataColumn 	c2 = t2.Columns.Add("C2") ;

ds.Relations.Add("T12T2",c1, c2) ;
ds.EnforceConstraints = false ;
DataRow r1 = t1.NewRow();
DataRow r2 = t2.NewRow() ;

r1[c1] = "1" ;
r2[c2] = "1" ;

t1.Rows.Add(r1) ;
t2.Rows.Add(r2) ;

ds.EnforceConstraints = true ;

ds.EnforceConstraints = false ;
ds.EnforceConstraints = true ; // <-- This throws the exception
Comment 1 Miguel de Icaza [MSFT] 2012-06-27 22:14:06 UTC
This is the same bug as Novell Bugzilla #650402 which we fixed shortly after 5.2.12 was released, it will be contained in the next MonoTouch stable and beta releases.