I tried commenting out all other threads in my program and re-run it. I still got the error. It seems to me that the error would be thrown if I open a form (which contains a grid and some buttons) and close the form (by clicking a button on the form) and doing this repeatedly for several times. It is really strange that a cross-thread operation could happen. From the stack trace, it shows something about disposing a grid element. I wonder what the stack trace tells about. Also, any help regarding this cross-thread operation error would be much appreciated. I really have no clue how to fix/debug it further. Thanks.
System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.DestroyHandle()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at Xceed.Editors.WinTextBox.Dispose(Boolean disposing)
at Xceed.Editors.WinNumericTextBox.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at Xceed.Grid.Editors.CellEditorManager.Dispose(Boolean disposing)
at Xceed.Grid.Editors.CellEditorManager.Dispose()
at Xceed.Grid.Column.DisposeCachedManagerNotFromManagerList(IDisposable manager)
at Xceed.Grid.Column.Finalize()