I am struggling with this exception under windows mobile 6.5
System.NotSupportedException was unhandled
Message="Control.Invoke must be used to interact with controls created on a separate thread."
StackTrace:
in Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
in System.Windows.Forms.Control.Dispose(Boolean disposing)
in OpenNETCF.Windows.Forms.OwnerDrawnList.Dispose()
in OpenNETCF.Windows.Forms.OwnerDrawnList.Finalize()
I am using a List of textboxes from OPENNETCF as a fancy looking menu. They are custom drawn, but I found out nothing is wrong with disposing / creating all those objects UNTIL a method in DoubleClick or KeyDown is invoked. In this method I initiate DataGrid and things that always worked.
Once I exit main form, this exception is thrown. It doesn't affect application in any way, except for that big ugly win32 exception at the end of using application. What am I missing? I am disposing those objects before redrawing a form.
@EDIT I managed to fix it by disposing all those objects in not Form.Disposed event which acts after parent class is disposed, but in Form.Closing event. My guess is NETCF uses some threading in the background, that is being disposed by windows.form.