SQLite Forum

Unable to load DLL 'SQLite.Interop.dll' (0x8007007E) using nuget version 1.0.114.4 of System.Data.Sqlite
Login

Unable to load DLL 'SQLite.Interop.dll' (0x8007007E) using nuget version 1.0.114.4 of System.Data.Sqlite

(1) By anonymous on 2021-06-22 12:41:28 [link] [source]

Hi,

I just updated my project to version 1.0.114.4 of System.Data.Sqlite and I got an error when loading SQLite.Interop.dll. I was able to minimize to a simple example, available here https://github.com/andrewhickman/sqlite-repro

To reproduce, run this docker command (using windows containers) on the latest commit in that repository

docker build . -t sqlite-repro ; docker run -it --rm sqlite-repro

I get the following exception

Unhandled exception. System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
   at System.Data.SQLite.SQLite3.StaticIsInitialized()
   at System.Data.SQLite.SQLiteLog.PrivateInitialize(String className)
   at System.Data.SQLite.SQLiteLog.Initialize(String className)
   at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
   at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
   at SqliteRepro.Program.Main(String[] args) in C:\source\Program.cs:line 10

Running the same command on the previous commit (37ec7a771d30ba1b6a0d506efc7d8ab858852e31), it runs successfully. The only difference is going from version 1.0.113.7 to 1.0.114.4 of System.Data.Sqlite

Just doing dotnet run in the repository works fine on both versions on my machine (again using Windows)

(2) By Larry Brasfield (larrybr) on 2021-06-22 13:56:59 in reply to 1 [source]

This recent post describes a problem created by an MSBuild change which I suspect has led to your issue. Either getting an MSBuild update or manually specifying another target to get SQLite.Interop.dll copied should function as a work-around. Or you could just copy the DLL yourself until that update is generally available.

(3) By anonymous on 2021-07-17 14:30:32 in reply to 2 [link] [source]

This actually seems to be caused by some extra dependencies in the latest version of SQLite.Interop.dll.

Using dumpbin I compared the dependencies between version 1.0.113.7 and 1.0.114.4 and these new dependencies were added:

    mscoree.dll
             1801473F0 Import Address Table
             180186090 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                          6F StrongNameSignatureVerificationEx
                          71 StrongNameTokenFromAssembly
                          62 StrongNameFreeBuffer
                           F CorBindToRuntimeEx
                          61 StrongNameErrorInfo

    WINTRUST.dll
             1801473E0 Import Address Table
             180186080 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                          82 WinVerifyTrust

mscoree.dll is not available in in the mcr.microsoft.com/dotnet/core/runtime image I was using. If I copy it in from a different image, SQLite.Interop.dll is loaded successfully