4

mono でバグを発見したと思いますが、完全に分離できていません。問題を分離するために助けが必要です。

このエラーを再現するには

  • csharp HelloWorld.cs を実行します。
  • 任意のセルをクリック
  • そのセルの内容を変更します。
  • 他のセルをクリックします。

注: 私の質問はこの質問に関連していると思いますが、問題の特定に近づいています。

注: Linux の mono 3.0.4 と mono 3.0.1 と mono 2.10.x でこれを試しました 注 2: これを .exe にコンパイルしようとしましたが、それでも同じエラーが発生します

次のコール トレース メッセージが生成されます。

System.ObjectDisposedException: The object was used after being disposed.
  at System.Windows.Forms.Control.CreateHandle () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.TextBoxBase.CreateHandle () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.CreateControl () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.set_Visible (Boolean value) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:set_Visible (bool)
  at System.Windows.Forms.DataGridView.BeginEdit (Boolean selectAll) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore (Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WmLButtonDblClick (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0 
System.ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count.
Parameter name: index
0
  at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException (System.String name, System.Object actual, System.String message) [0x00000] in <filename unknown>:0 
  at System.Collections.ArrayList.get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridViewRowCollection.SharedRow (Int32 rowIndex) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.GetRowInternal (Int32 rowIndex) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.GetCellInternal (Int32 colIndex, Int32 rowIndex) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.OnCellLeave (System.Windows.Forms.DataGridViewCellEventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore (Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.MoveCurrentCell (Int32 x, Int32 y, Boolean select, Boolean isControl, Boolean isShift, Boolean scroll) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.OnColumnCollectionChanged (System.Object sender, System.ComponentModel.CollectionChangeEventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridViewColumnCollection.OnCollectionChanged (System.ComponentModel.CollectionChangeEventArgs e) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridViewColumnCollection.Clear () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.DataGridView.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Component.Dispose () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.ComponentModel.Component:Dispose ()
  at System.Windows.Forms.Control.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ContainerControl.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Component.Dispose () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.ComponentModel.Component:Dispose ()
  at System.Windows.Forms.Form.WmClose (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0 

HelloWorld.cs の内容:

using System.Data;
using System.Drawing;
using System.Windows.Forms;

public class HelloWorld : Form {
    public HelloWorld () {
        Button quit = new Button ();
        quit.Text = "quit";
        quit.Click += new EventHandler (OnClickQuit);
        quit.Location = new Point(500, 400);

        DataGridView dgv = new DataGridView();
        dgv.AutoSize = true;

        DataTable table1 = new DataTable("patients");
        table1.Columns.Add("name");
        table1.Columns.Add("id");
        table1.Rows.Add("sam", 1);
        table1.Rows.Add("mark", 2);

        DataSet ds = new DataSet("office");
        ds.Tables.Add(table1);

        dgv.DataSource = ds;
        dgv.DataMember = ds.Tables[0].TableName;
        Controls.AddRange(new Control[] { dgv, quit });
    } 
    void OnClickQuit(object sender, EventArgs e) {
        Close();
    }
}

Application.Run (new HelloWorld ());
4

0 に答える 0