Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
690
I get error: "cannot access a disposed object" - it involves the column chooser and the grid datasource
posted

Hi,

I have attached a sample application which shows the issue. To replicate:

1. use v10.3 (2145).

2. load solution in VS2010, run it

3. in the left grid, edit either columns cell value, while still in edit mode,

4. click on the right column chooser, onto 'column 0'. the error will show.

I think the issue is that the column chooser has cached the columns from the grid, even if the grids datasource is set to null, the column chooser still thinks the columns exist. So eventually you get this error.

In my application, I am not setting the datasource to null in the exiteditmode event ( for ease of replicating it for you I just set the datasource to null in the sample code). In my code, I am rebuilding the datasource, but the result is the same error. I think, it is because at some point, the columns are changed, so they are disposed, but is still accessed by the column chooser in the mouse down event

I've found no way to try to avoid this issue without changing the infragistics code. Can you tell me if there is way to workaround this?

the error call stack is:

************** Exception Text **************
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Infragistics.Win.UltraWinGrid.UltraGridColumn'.
   at Infragistics.Shared.DisposableObject.VerifyNotDisposed()
   at Infragistics.Shared.SubObjectBase.NotifyPropChange(PropChangeInfo trigger)
   at Infragistics.Win.UltraWinGrid.UltraGridColumn.InternalSetSortIndicator(SortIndicator sortIdicator)
   at Infragistics.Win.UltraWinGrid.SortedColumnsCollection.InternalClear()
   at Infragistics.Win.UltraWinGrid.SortedColumnsCollection.ApplyNewSortedColumns(SortedColumnsCollection newSortedColumns, Boolean groupBy)
   at Infragistics.Win.UltraWinGrid.SortedColumnsCollection.ProcessNewSortedColumnsHelper(SortedColumnsCollection newSortedColumns, Boolean fireEvents, Boolean groupBy)
   at Infragistics.Win.UltraWinGrid.SortedColumnsCollection.SetSortedColumn(UltraGridColumn column, SortIndicator sortIndicator, Boolean groupBy, Boolean clearExistingNonGroupByColumns, Boolean fireEvents)
   at Infragistics.Win.UltraWinGrid.UltraGridBand.SetSortedColumn(UltraGridColumn column, SortIndicator sortIndicator, Boolean clearExisting)
   at Infragistics.Win.UltraWinGrid.UltraGridColumn.ClickSortIndicator()
   at Infragistics.Win.UltraWinGrid.HeaderUIElement.EndDragHelper(Boolean cancelled)
   at Infragistics.Win.UltraWinGrid.HeaderUIElement.OnDispose()
   at Infragistics.Shared.DisposableObject.Dispose()
   at Infragistics.Win.UIElement.OnDispose()
   at Infragistics.Shared.DisposableObject.Dispose()
   at Infragistics.Win.UIElement.OnDispose()
   at Infragistics.Win.UltraWinGrid.RowUIElementBase.OnDispose()
   at Infragistics.Shared.DisposableObject.Dispose()
   at Infragistics.Win.UIElementsCollection.DisposeElements()
   at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
   at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e)
   at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
   at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WindowsFormsApplication365.rar