Unable to load DLL in compiled components on some machines

Hi all,

I have a very small component that uses sqlite dependencies.
When I compile it, it runs on my machine but on others it seems to cause problems loading the SQLIte.Interop.Dll:

Can anybody help me with that?
I searched a bit of the forum and tried a lot of different among others this one I read here:

but I wasn’t able to get it run.
Here are the files:
20210502_SQLite.zip (1.7 MB)
Any help/hint is really apreciated.

Thanks and have a nice sunday!

Those HResult errors means that compiler does not find native cpp .dll

Does this .dll interop with cpp pinvoke methods that are not in your libraries folder?

The easiest way to debug this is to skip all the rhino interface. Create an app with console application. Once you are able to run it there wrap it to gh component.

Thanks for the response @Petras_Vestartas.

As I understand it is not. The code is really short:

        protected override void SolveInstance(IGH_DataAccess DA)
            //Retrive the inputs
            string cs = string.Empty;
            if (!DA.GetData(0, ref cs)) return;

            string query = string.Empty;
            if (!DA.GetData(1, ref query)) return;
            SQLiteConnection connection = new SQLiteConnection("Data Source=" + cs + ";Version=3;");

            List<System.Object> data = new List<System.Object>();

            using (SQLiteCommand fmd = connection.CreateCommand())
                fmd.CommandText = query;
                fmd.CommandType = CommandType.Text;
                SQLiteDataReader r = fmd.ExecuteReader();

                while (r.Read())
            DA.SetDataList(0, data);

Ok, I will try this. Since I nearly never use VS or C# outside Rhino this will be a good exercise.

I was just thinking: If I copy all dependencies in the build, could that be a way?

Before doing this, does this code works in console app?

Dll may reference nested .dll inside it, that wont copy using copy local.

thanks again,
as I mentioned I am not doing this very often, that’s why I am not sure if I did it right.
So the console is not showing the value, but whilst debugging I can see the values from the table was added to the list, which makes me think, it is working.

Can you show a screenshot when you press “Start Without Debugging” or Ctrl+F5 ?

And also dependencies list?

oh, ok. there is the correct value

Ok, you are running .NET Core and Rhino Grasshopper is .NET framework.

These are two different systems. Try to create a new project and repeat the process using this:

ok, thanks for the patience!

Looks good, standard app find sub dlls.

If you just copy paste this SQLite.Interop.dll from your computer to grasshopper folder do you still get error. I mean manually copying from one of these directories:

If that does not work share the grasshopper plugin here with the data source file.

And what I see from console app is that you are using not oneS dll but 6 interlinked .dlls so these one have to be referenced as well in gh plugin:

Hi, thanks for the offer. I tried everything you described(as I understood), but still it won’t work on the other machine.
It seems to be too heavy for attaching here, I’ll send you it to you in a pm.

Thanks again!

Hi Baris,

not sure if this is part of the problem, but try to download the latest SQLite via package manager in visual studio. Then make sure your solution is targeting the same .NET Framework version as the latest SQLite build is uses. If fore some reason it uses a higher .NET Framework that is currently installed in you pc ( you will notice this in VS) just download it and repeat the process.

1 Like