Feedback
Did this article resolve your question/issue?

   

Article

Dispose not called on components on inherited WindowContainer

Information

 
TitleDispose not called on components on inherited WindowContainer
URL Namedispose-not-called-on-components-on-inherited-windowcontainer
Article Number000138444
EnvironmentProduct: OpenEdge
Version: 10.2x, 11.x
OS: Windows
Other: GUI for .NET
Question/Problem Description
Dispose is not called on components on inherited WindowContainer.

ComponentCollection property is not available when creating an inherited WindowContainer (Progress.Windows.WindowContainer)

Classes inheriting from Progress.Windows.Form or Progress.Windows.UserControl do have a ComponentCollection property.
Steps to Reproduce
Clarifying Information
ComponentCollection property and associated code have been implemented to ensure that components are cleaned up when they are disposed of.

Both Progress.Windows.Form and Progress.Windows.UserControl provides a ComponentCollection property.

See article# 000034180, "PDSOE 11.1 User Control and Form constructor code is different to previous versions" for more information.
 
Error Message
Defect/Enhancement NumberDefect OCTA-10015
Cause
Progress.Windows.WindowContainer inherits from System.Windows.Forms.UserControl, rather than Progress.Windows.UserControl. As a result, the ComponentCollection property and associated code are not present in the generated class.
Resolution
Until the fix is available, use the workaround below.
Workaround
Add the following code to the classes to implement a clean-up mechanism

Definitions:
DEFINE PRIVATE VARIABLE components AS System.ComponentModel.IContainer NO-UNDO.

Constructor:
components = NEW System.ComponentModel.Container().
Disposed:Subscribe(<className>_Disposed).

New Method:
METHOD PRIVATE VOID <className>_Disposed(sender AS Object, e AS System.EventArgs):
     components:Dispose().
END METHOD.


If present, remove this code from the DESTRUCTOR:
IF VALID-OBJECT(components) THEN 
DO:
    CAST(components, System.IDisposable):Dispose().
END.
Notes
References to other documentation:

Progress article(s):
000034180, "PDSOE 11.1 User Control and Form constructor code is different to previous versions"
Last Modified Date12/14/2018 12:18 PM
Attachment 
Files
Disclaimer 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.