koureasstavros / SQLServer2022EzApi

About Fork of EzApi. Stand-alone edition for SQL Server 2022 version
3 stars 1 forks source link

Script Component fail to get the Host Crash on Null Pointer #1

Open peans99 opened 6 hours ago

peans99 commented 6 hours ago

Line 2259: of ezComponent.

private ScriptComponentHost host { get { return (Comp as IDTSManagedComponent100).InnerObject as ScriptComponentHost; } }

I noticed it work with the version of 2016 stopped working with the 2019 version. I am not sure if its a bug in microsoft implementation but this break the script component

koureasstavros commented 5 hours ago

Hi peans99,

Could you test the same with the proper version of Ezapi Package? In my profile I have multiple Ezapi repositories one per SqlServer major version. So if you are using SQL Server 2019 try to check first the Ezapi 2019. Or are you talking about Ezapi version already?

peans99 commented 5 hours ago

I am testing with your version SQLServer2022EzApi. the 2019 version also failed with sql 2019

I did some additional test and its really weird. if I use a dynamic variable it work

        var test2 = Comp as IDTSManagedComponent100;
        var test3 = test2.InnerObject;
        test3.PutSourceCode(fileName, VSTAScriptProjectStorage.Encoding.UTF8.ToString(), srcCode);
        host.PutSourceCode(fileName, VSTAScriptProjectStorage.Encoding.UTF8.ToString(), srcCode);

It work using : https://github.com/fpvmorais/EzApi2016 , your 2019 didnt work. I am still running additional test

peans99 commented 5 hours ago

Let me try your 2016 with my sql 2016 to see if its something between your version and fpvmorais version

peans99 commented 3 hours ago

your 2016 version also work but not 2019 and 2022 this is a weird one.

peans99 commented 1 hour ago

so I got it working by changing this . I dont know why the wrapper don't work past 2016

    private dynamic host
    {
        get
        {
            return (Comp as IDTSManagedComponent100).InnerObject;
        }
    }

    public dynamic ScriptingEngine
    {
        get
        {
            return host.CurrentScriptingEngine; 
        }
    }
peans99 commented 26 minutes ago

https://github.com/peans99/SQLServer2022EzApi/commit/5f3df5487fff5f5982a585d48f92870216eec046

example is here it work me for me now . It just a weird weird issue I don't know whats happening that can create this in the com wrapper