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?
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
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:
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.
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.
@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.
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.