Hybrid objects assigned to System.Windows.Forms.Timer:Tag are never garbage collected
When assigning a hybrid object (ABL object inheriting from a .Net object) to the Tag property of a System.Windows.Forms.Timer and removing it again in the Timer:Tick event, the object never gets garbage collected. For example the hybrid class is:
USING System.Object FROM ASSEMBLY.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS SimpleObject
INHERITS Object:
END CLASS.
If this is assigned to a timer Tag property:
DEFINE PRIVATE VARIABLE Timer AS System.Windows.Forms.Timer NO-UNDO.
...
THIS-OBJECT:Timer = NEW System.Windows.Forms.Timer(THIS-OBJECT:components).
...
Timer:Tag = NEW SimpleObject().
Timer:Start().
The timer Tick event handler removes the reference to the hybrid class, so it should be garbage collected:
METHOD PRIVATE VOID Timer_Tick(sender AS Object, e AS EventArgs):
Timer:Stop().
ASSIGN Timer:Tag = ?.
END METHOD. /* Timer_Tick */
But this never happens. With DynObjects.Class client logging it can be seen in the log that the object is never garbage collected:
[18/09/05@09:41:01.647+0100] P-019624 T-021376 2 4GL DYNOBJECTS Created Progress.Lang.Object Handle:1024 (StartLeakingButton_Click TimerLeakForm @ 50) SimpleObject
There is never a corresponding Deleted line for this object in the log.