xsharp.eu • InCollect() Deprecated
Page 1 of 1

InCollect() Deprecated

Posted: Tue Jul 22, 2025 5:45 am
by JoeD
Hi everyone,

I get a lot of warnings like:
'XSharp.RT.Functions.InCollect()' is obsolete: ''InCollect()' is not supported'

This is related to code like the following:

Code: Select all

        
IF .NOT. InCollect()
    UnRegisterAxit(SELF)
    SELF:oSomeObject := NULL_OBJECT
ENDIF
Is there any documentation on what this method actually does and how it should be replaced?

Also, are there any implications or side effects I should be aware of when simply removing this check?

Thank you
Johannes

Re: InCollect() Deprecated

Posted: Tue Jul 22, 2025 6:21 am
by wriedmann
Hi Johannes,
InCollect() in X# does nothing because the VO garbage collector is not present anymore - X# uses the .NET memory managment and the relative garbage collector (that is much more stable and fast).
InCollect() in VO checks if the garbage collector is currently running and doing his work.
Wolfgang

Re: InCollect() Deprecated

Posted: Tue Jul 22, 2025 6:48 am
by robert
Johannes,
This function always returns FALSE in X#:
See:

https://github.com/X-Sharp/XSharpPublic ... GC.prg#L52

Robert

Re: InCollect() Deprecated

Posted: Wed Jul 23, 2025 5:41 am
by JoeD
Thank you, Wolfgang and Robert, for the information and for pointing me to the location in the source code.
I suppose I could have thought of checking the source myself.

I’ll go ahead and remove the checks then.

Best regards,
Johannes