Getting System.InvalidOperationException when closing a form displayed in a tab of ultraTabbedMdiManager


EnvironmentProduct: OpenEdge
Version: 10.2x, 11.x
OS: Windows
Other: NETUI, GUI for .NET, Infragistics Controls
Question/Problem Description

When closing a form that was parented by an Mdi form using (ultraTabbedMdiManager) the following error is shown:

System.InvalidOperationException: Operation is not valid due to the current state of the object
Steps to ReproduceUse attached workspace file. Run "mitsi.cls", open a form, close the form.
Clarifying Information

Stack Trace from .NET:

System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at Infragistics.Win.ChildControlEventManager..ctor(Control rootControl)
   at Infragistics.Win.ControlUIElementBase.MouseEventManager..ctor(ControlUIElementBase controlElement)
   at Infragistics.Win.ControlUIElementBase.Initialize(Control control, IUltraControl ultraControl, ProcessEvent eventsToProcess)
   at Infragistics.Win.ControlUIElementBase..ctor(Control control, IUltraControl ultraControl, Boolean hookEvents)
   at Infragistics.Win.Misc.UltraGroupBoxUIElement..ctor(UltraControlBase groupBoxControl)
   at Infragistics.Win.Misc.UltraGroupBox.get_ControlUIElement()
   at Infragistics.Win.Misc.UltraGroupBox.get_DisplayRectangle()
   at System.Windows.Forms.Layout.DefaultLayout.UpdateAnchorInfo(IArrangedElement element)
   at System.Windows.Forms.Layout.DefaultLayout.InitLayoutCore(IArrangedElement element, BoundsSpecified specified)
   at System.Windows.Forms.Layout.LayoutEngine.InitLayout(Object child, BoundsSpecified specified)
   at System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
   at System.Windows.Forms.Control.Dispose(Boolean disposing)
   at Infragistics.Win.UltraControlBase.Dispose(Boolean disposing)
   at Infragistics.Win.Misc.UltraGroupBox.Dispose(Boolean disposing)
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Control.Dispose(Boolean disposing)
   at System.Windows.Forms.Form.Dispose(Boolean disposing)
   at Progress.Windows.Form.Dispose(Boolean disposing)
   at resale.purchasing.catalogue.CatalogueMaintenance.Dispose(Boolean )
   at System.ComponentModel.Component.Dispose()
   at System.Windows.Forms.Form.WmClose(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at Progress.Windows.Form.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, Int32 lparam)
   at System.Windows.Forms.Form.Close()
   at Infragistics.Win.UltraWinTabbedMdi.MdiTab.Close()
   at Infragistics.Win.UltraWinTabbedMdi.MdiTab.Close(MdiTabCloseReason closeReason)
   at Infragistics.Win.UltraWinTabbedMdi.MdiTabGroup.MdiTabGroupManager.CloseButtonClick(ITabItem tab, TabCloseReason reason)
   at Infragistics.Win.UltraWinTabs.TabCloseButtonUIElement.ButtonClick()
   at Infragistics.Win.ButtonUIElementBase.OnClick()
   at Infragistics.Win.ControlUIElementBase.ProcessMouseUpHelper(Object sender, MouseEventArgs e)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseUp(Object sender, MouseEventArgs e)
   at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
   at Infragistics.Win.UltraWinTabbedMdi.MdiTabGroupControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   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)


Error MessageSystem.InvalidOperationException: Operation is not valid due to the current state of the object
Defect/Enhancement Number

The form that is displayed in the Tab instantiates an ABL class, which then instantiates an Infragistics.Win.Misc.UltraValidator object.  The application code attempted to cleanup the UltraValidator object by using the DELETE OBJECT statement.

Deleting a .NET object is always dangerous because .NET may still be using/referencing the object.  .NET Components that need to be cleaned up from within the ABL should be disposed, not deleted.

Use the Dispose method:

For instance:

Last Modified Date11/13/2015 6:46 PM

The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.

Was this article helpful?


Your feedback is appreciated.

Please tell us how we can make this article more useful.

Characters Remaining: 255