Cleanup() returns null

SOLVED

I have a C# code that integrates with Sage 100 2021 Standard.

After performing some action I want to clean and close the session I opened. for this I'm using:

session.nCleanup();
session.DropObject();

for some reason the nCleanup() returns null instead of 0 as it says in here:

(taken from https://help-sage100.na.sage.com/2022/FLOR/index.htm#Object_Reference/BaseSystem/SY_Session.htm?Highlight=sy_session )

after cleanup() the value of sLastErrorMsg is empty, meaning there was no error, and after calling DropObject() I see in Master Console in Sage that the task was  terminated.

Does anyone knows why it returns null and not 0?

Parents
  • +1
    verified answer

    There is actually no RETURN value/expression from the Cleanup method in SY_Session, so the null value when called externally is correct. As to the documentation discrepancy, its based on calling this method from ProvideX. In ProvideX a method will always return a value, even if a method ends with just a RETURN (which will return a 0, or empty string if the method is postfixed with a $).

    Hope this helps.
    Russell

Reply
  • +1
    verified answer

    There is actually no RETURN value/expression from the Cleanup method in SY_Session, so the null value when called externally is correct. As to the documentation discrepancy, its based on calling this method from ProvideX. In ProvideX a method will always return a value, even if a method ends with just a RETURN (which will return a 0, or empty string if the method is postfixed with a $).

    Hope this helps.
    Russell

Children