SQLite error in Rhino 8 with .NET 4.8

I have a plug-in that targets .NET framework 4.8 and includes an SQLite database (using the SQLitePCLRaw.bundle_winsqlite3 nuget package), which works fine in Rhino 7.

A first test with Rhino 8 (both with SetDotNetFramework and the /netfx command line argument) shows that while the plug-in itself loads correctly, the SQLite database throws the following error:

System.TypeInitializationException: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Library e_sqlite3 not found
plat: win
suffix: DLL
possibilities (2):
    1) C:\Program Files\Rhino 8 WIP\System\runtimes\win-x64\native\e_sqlite3.dll
    2) C:\Program Files\Rhino 8 WIP\System\e_sqlite3.dll
win TryLoad: C:\Program Files\Rhino 8 WIP\System\runtimes\win-x64\native\e_sqlite3.dll
thrown: System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found
   at SQLitePCL.NativeLibrary.TryLoad(String name, Loader plat, Action`1 log, IntPtr& h)
win TryLoad: C:\Program Files\Rhino 8 WIP\System\e_sqlite3.dll
thrown: System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found
   at SQLitePCL.NativeLibrary.TryLoad(String name, Loader plat, Action`1 log, IntPtr& h)
NOT FOUND

   at SQLitePCL.NativeLibrary.Load(String libraryName, Assembly assy, Int32 flags)
   at SQLitePCL.Batteries_V2.MakeDynamic(String name, Int32 flags)
   at SQLitePCL.Batteries_V2.DoDynamic_cdecl(String name, Int32 flags)

I saw that Rhino 8 seems to use the same package, judging from the DLLs in the System folder, so I made sure to use the same version in case that might have caused some issues, but to no effect.

What does Rhino 8 do differently than 7 that might cause this problem?

An error occurred during GH_Canvas::InstantiateNewObject() might be related.

You likely have installed these dlls yourself into that location. Check with a tool like GitHub - lucasg/Dependencies: A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues. that the e_sqlite3.dll dependencies are all found.

I didn’t install any DLLs directly/manually. In both Rhino 7 and 8 scenarios, I just referenced the Nuget package SQLitePCLRaw.bundle_winsqlite3 in my project and built the plug-in.

Also: this is a development setting on the same machine. The only difference is the executable VS launches when debugging the plug-in:

  • C:\Program Files\Rhino 7\System\Rhino.exe works
  • C:\Program Files\Rhino 8 WIP\System\Rhino.exe /netfx fails to load the sqlite dll

My point is that Rhino doesn’t come with SQLite3 files, so they come from somewhere. Still you should check with the tool I suggested.

I just removed and re-installed Rhino 8 WIP. Without launching it or doing anything else, I found the following libraries installed into ...Rhino 8 WIP\System:

SQLitePCLRaw.batteries_v2.dll
SQLitePCLRaw.core.dll
SQLitePCLRaw.provider.dynamic_cdecl.dll

Regarding checking for missing DLLs: I mean, the error message itself already states that it doesn’t find the DLL. The question to me is, why is that? How come that the same program, built in the same way does find this library when started within Rhino 7 but not within Rhino 8?

Hmm, probably @curtisw has more insight into SQlite loading.

I did see though with Dependencies tool that dl is not being found… I don’t know what it is or what it is for, but I’d imagine that this is part of why batteries v2 in your first stack trace is part

Did you resolve this issue Thomas? We are migrating our code base from Net Framework 4.8 to .NET 7 and testing plugin in Rhino 8 and seeing the same issue. The e_sqlite3.dll and others exist in our plugin “runtimes” folder but not in the locations 1) and 2) that Rhino is searching.

This worked seamlessly in Rhino 7 for us.

Sorry, I didn’t find a solution yet. The migration was postponed on our end and I haven’t looked at this issue in a while.

Has anyone managed to resolve this? We don’t have a way to influence the assembly load path and it is picking up these older versions. This from a fresh Rhino install - 2.1.0 version from around Nov last year, even bumping the version a little would help tbh.

From our side, it seems that we no longer depend on sqlite, so we will remove it so that it does not ship with Rhino. We’ll report back here when it has been removed so you know which Rhino service release to test.

4 Likes

Hi @fraguada, thanks for fixing. We are having the same issue and looking forward to testing the new version.

@Alain has committed the change to remove sqlite from Rhino. This should be included in Rhino 8.3 RC1 which should go out later today if things go “as planned”. Make sure you enable service release candidates in Rhino to get this update.

2 Likes

RH-79009 is fixed in Rhino 8 Service Release 3 Release Candidate

2 Likes

Thanks for much for the rapid turn around @fraguada @brian @Alain

1 Like

Thanks all, I can confirm that the new release of Rhino 8 SR3 works fine with SQLite.

1 Like

Thank you, @fraguada and @brian! Do you know when the SR3 will be the official latest release? From what I can see, the download link is still pointing to v8.2.

I’m waiting for version 8.3 to be the official release before making the announcement for official support of Rhino 8.

Hi Mostapha -

When nothing goes wrong, Service Releases are released on the second Tuesday of the month. So, SR3 should be out on January 9th.
-wim

1 Like