Feedback
Did this article resolve your question/issue?

   

Article

Why is the Dispose() method FINAL in ABL?

Information

 
TitleWhy is the Dispose() method FINAL in ABL?
URL NameWhy-is-the-Dispose-method-FINAL-in-ABL
Article Number000133670
EnvironmentProduct: OpenEdge
Version: 10.2x, 11.x
OS: Windows
Other: GUI for .NET, garbage collection
Question/Problem Description
Why is the Dispose() method FINAL in ABL?

Why is it not possible to override the Dispose method in ABL?

Why can't the Dispose method be overridden in ABL?
 
Steps to Reproduce
Clarifying Information
It is possible to override the Dispose() method in .NET languages (C#, VB.NET).

Attempting to implement an override of Dispose() fails with compiler error 12999.

The behaviour is documented in the OpenEdge Development: GUI for .NET Programming but no reason is provided for why Dispose() is FINAL.

"You cannot override a .NET method defined as any of the following:

• static
• sealed (FINAL)
• DestroyHandle( ) method
• Dispose( ) method
• Finalize( ) method
• GetHashCode( ) method

The listed methods are all defined as overrideable in .NET. However, ABL defines these methods as FINAL for an ABL session."

https://documentation.progress.com/output/ua/OpenEdge_latest/#page/dvngp%2Foverriding-.net-methods.html%23
Error MessageMethod 'Dispose' in class hierarchy is FINAL. Cannot be override (12999)
Defect/Enhancement NumberDefect OCTA-6957
Cause
Resolution
The behaviour is by design, to protect the ABL Virtual Machine (AVM). 
Dispose() was made FINAL because it is called on the garbage collection thread. The AVM is not multi-threaded, so overriding Dispose() is prevented in order to avoid crashes.

Defect OCTA-6957 has been logged to request additional information be added to the documentation to clarify further.
Workaround
As an alternative, consider adding a handler for Disposed event.
Notes
References to other documentation:

OpenEdge Development: GUI for .NET Programming, "Chapter 2: Accessing and Managing .NET Classes from ABL > Defining ABL-extended .NET objects > Deriving .NET classes in ABL > Overriding .NET methods"
Last Modified Date7/10/2018 8:06 AM
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.