2) I will make a change to the VO SDK code. The contents of Axit() will be moved to another method (Destroy() or Close()) and Axit will call that method. You can then call that method in your code too if you want to force close the session before the garbage collector kicks in.
Robert
But in the forelast version of X# I use I still get
Error XS0245 Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available.
on a line like oParser:Axit() .
I assumed that with the above that should no longer give an error?
Dick,
Axit methods should not be called directly. Also not in VO. They are called by the Garbage collector when needed.
The best approach is:
- Move the body of the Axit() method to a Destroy() method
- Call Destroy() from inside Axit()
- When you want to cleanup under program control, call Destroy() and not Axit()
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
I concluded from your earlier reply that the error would be fixed (without change), but changing Axit to Destroy in some places should be easy as well.
FUNCTION Start( ) AS VOID
Test()
Gc.Collect()
Console.ReadLine()
FUNCTION test AS VOID
LOCAL oChild AS Child
oChild := Child{}
? oChild
RETURN
CLASS Parent
DESTRUCTOR()
? "Inside Parent destructor"
END CLASS
CLASS Child INHERIT Parent
DESTRUCTOR()
? "Inside Child destructor"
END CLASS
XSharp Development Team
The Netherlands
robert@xsharp.eu