WeakReference exception when disposing GridDataBoundGrid

Form.Dispose(bool) method fails with the exception (stak trace is below). I am using Essential Grid version 2.0.3.0 catched at Syncfusion.Windows.Forms.Grid.GridTextBoxControl.WndProc(Message& msg) System.InvalidOperationException: Handle is not initialized. at System.WeakReference.get_IsAlive() at Syncfusion.Windows.Forms.Grid.GridFontInfo.get_GdipFont() at Syncfusion.Windows.Forms.Grid.GridStyleInfo.get_GdipFont() at Syncfusion.Windows.Forms.Grid.GridStyleInfo.get_GdipFont() at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.get_Font() at System.Windows.Forms.Control.GetParentFont() at System.Windows.Forms.Control.get_Font() at System.Windows.Forms.RichTextBox.get_Font() at System.Windows.Forms.Control.AssignParent(Control value) at System.Windows.Forms.ControlCollection.Remove(Control value) at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at Syncfusion.Windows.Forms.Grid.GridTextBoxCellRenderer.Dispose(Boolean disposing) at Syncfusion.ComponentModel.NonFinalizeDisposable.Dispose() at Syncfusion.Windows.Forms.Grid.GridCellRendererCollection.Clear() at Syncfusion.Windows.Forms.Grid.GridCellRendererCollection.Dispose(Boolean disposing) at Syncfusion.ComponentModel.NonFinalizeDisposable.Dispose() at Syncfusion.Windows.Forms.Grid.GridControlBase.Dispose(Boolean disposing) at Syncfusion.Windows.Forms.Grid.GridControlBaseImp.Dispose(Boolean disposing) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing) at System.Windows.Forms.Form.Dispose(Boolean disposing) Grid DataSource property is set to null before disposing

3 Replies

AD Administrator Syncfusion Team May 12, 2004 07:07 PM UTC

Before zapping the grid, try making sure there is not an active current cell with code like this.grid.CurrentCell(-1, -1); You should upgrade to release 2.0.5.1. 2.0.3.0 is a beta release.


EM Eugene Mishura May 12, 2004 08:08 PM UTC

grid.CurrentCell.MoveTo(-1,-1) to be precise... Unfortunately, it does not work. I have the same exception. I even tried to clear current selection like grid.Model.SelectedRanges.Clear(); but it caused other exception when I try to set grid.DataSource=null The other exception says: catched at Syncfusion.Windows.Forms.Grid.GridTextBoxControl.WndProc(Message& msg) System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.GridModel.get_Item(Int32 rowIndex, Int32 colIndex) at Syncfusion.Windows.Forms.Grid.GridControlBase.GetViewStyleInfo(Int32 rowIndex, Int32 colIndex, Boolean forceQueryCellInfo) at Syncfusion.Windows.Forms.Grid.GridControlBase.GetViewStyleInfo(Int32 rowIndex, Int32 colIndex) at Syncfusion.Windows.Forms.Grid.GridControlBase.GetCellRenderer(Int32 rowIndex, Int32 colIndex) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.BinderDataSourceChanged(Object sender, EventArgs e) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.OnDataSourceChanged(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.Set_ListManager(Object newDataSource, String newDataMember, Boolean force, Boolean forceColumnCreation) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.Set_ListManager(Object newDataSource, String newDataMember, Boolean force) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.set_DataMember(String value) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.set_DataSource(Object value) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.set_DataSource(Object value)


AD Administrator Syncfusion Team May 12, 2004 08:46 PM UTC

Have you tried the release version?

Loader.
Up arrow icon