The SetupData object could not be released while closing the script

1

When I save my setup object for the first time the custom properties get saved. When I launch the setup again, I can read the custom properties from it. The data seems to get saved correctly.

This is an example code of my RunUI method

    public KfxReturnValue RunUI()
    {
        FrmSetup frmSetup = new FrmSetup();

        try
        {
            if (frmSetup.ShowSetupForm(ref setupData) == DialogResult.OK)
            {
                setupData.Apply(); // save the data which got setup in the form
            }

            return KfxReturnValue.KFX_REL_SUCCESS;
        }
        catch (Exception e)
        {
            // Log the exception
            return KfxReturnValue.KFX_REL_ERROR;
        }
    }

Somehow I get this error message

2018-12-04 15:27:29, 0x00000018, 0, 0x00000000, 0x00000000, 0x00000000, C:\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin, admin, WINIKEL0FFCRM9:Sess 1, 11.0.0.0.0.397, , 130, Warning: The SetupData object could not be released while closing the script. ScriptName = C#.Net Release Template, Version=8.0, Reference Count = 4., ,

In my release script the setup data is empty. Somehow I have a data loss between setup and release. But the setup data gets saved correctly because I can read it within my setup while launching it multiple times.

c#
kofax
asked on Stack Overflow Dec 4, 2018 by hrp8sfH4xQ4 • edited Dec 7, 2018 by hrp8sfH4xQ4

1 Answer

0

How about if you do this:

public KfxReturnValue RunUI()
{
    using(FrmSetup frmSetup = new FrmSetup())  
    {
        try
        {
            if (frmSetup.ShowSetupForm(ref setupData) == DialogResult.OK)
            {
                setupData.Apply(); // save the data which got setup in the form
            }

            return KfxReturnValue.KFX_REL_SUCCESS;
        }
        catch (Exception e)
        {
            // Log the exception
            return KfxReturnValue.KFX_REL_ERROR;
        }
    }
}
answered on Stack Overflow Dec 13, 2018 by Leo

User contributions licensed under CC BY-SA 3.0