[Mono-bugs] [Bug 80465][Wis] New - Invalid argument crash in EndEdit

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jan 5 20:23:55 EST 2007


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 kobruleht2 at hot.ee.

http://bugzilla.ximian.com/show_bug.cgi?id=80465

--- shadow/80465	2007-01-05 20:23:55.000000000 -0500
+++ shadow/80465.tmp.30005	2007-01-05 20:23:55.000000000 -0500
@@ -0,0 +1,89 @@
+Bug#: 80465
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: kobruleht2 at hot.ee               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Invalid argument crash in EndEdit
+
+1. Run code in Windows XP in .NET 2 profile
+2. Activate grid cell
+3. Press space bar
+
+Observed:
+
+Application exists
+  
+Expected:
+ 
+ Grid row must be deleted
+ 
+Code to reproduce:
+
+using System.Windows.Forms;
+using System.Data;
+static class Program {
+	static void Main() {
+		Application.Run(new Frm());
+	}
+}
+
+class Frm : Form {
+	public Frm() {
+		DataGrid dataGrid1 = new grid();
+		DataSet dataSet1 = new DataSet();
+		dataSet1.Tables.Add();
+		dataSet1.Tables[0].Columns.Add();
+		dataSet1.Tables[0].Rows.Add();
+		dataGrid1.DataSource = dataSet1;
+		dataGrid1.DataMember = dataSet1.Tables[0].TableName;
+		Controls.Add(dataGrid1);
+	}
+}
+
+class grid : DataGrid {
+	protected override bool ProcessCmdKey(ref Message msg, Keys 
+keyData) {
+
+		GetCurrentRow().Delete();
+		DataSet ds = (DataSet)DataSource;
+		for (int nTable = 0; nTable < ds.Tables.Count; nTable++) {
+			for (int nRow = 0; nRow < ds.Tables
+[nTable].Rows.Count; nRow++) {
+				if (ds.Tables[nTable].Rows[nRow].HasVersion
+(DataRowVersion.Proposed)) {
+					ds.Tables[nTable].Rows
+[nRow].EndEdit();
+				}
+			}
+		}
+		return true;
+	}
+
+
+	public virtual DataRowView GetCurrentRow() {
+		CurrencyManager cm = GetCurrencyManager();
+		return (DataRowView)cm.Current;
+	}
+
+	public virtual CurrencyManager GetCurrencyManager() {
+		return (CurrencyManager)BindingContext[
+			DataSource, DataMember];
+	}
+}
+
+Stack trace:
+
+An invalid argument was specified.
+at System.Data.Common.RecordCache.DisposeRecord (Int32 index)
+at System.Data.DataRow.EndEdit ()


More information about the mono-bugs mailing list