praeclarum / praeclarum/sqlite-net

System.TypeInitializationException ----> System.DllNotFoundException : e_sqlite3

Open
#643 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I have installed the sqlite-pcl-net package (1.5.166-beta) into my (NUnit 3) unittest project. When running it from a Windows machine there is no problem at all. When I start running it from my Macbook then I get the following exception:

  1. Error : MyUnittest System.TypeInitializationException : The type initializer for 'SQLite.SQLiteConnection' threw an exception.
    ----> System.DllNotFoundException : e_sqlite3
    at <0x00000 + 0x00000>
    at MyUnitTest () [0x00067] in <96f31be6e71a42f5b7ad9b980609362a>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0
    --DllNotFoundException
    at (wrapper managed-to-native) SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods:sqlite3_libversion_number ()
    at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number () [0x00000] in <3cda1046b2804ce4a20e43f25d72d618>:0
    at SQLitePCL.raw.SetProvider (SQLitePCL.ISQLite3Provider imp) [0x00008] in <73e712ea9d1b47d7be4afb0c91ae9225>:0
    at SQLitePCL.Batteries_V2.Init () [0x00005] in <9806960da759467bb986d04e57c12bfa>:0
    at SQLite.SQLiteConnection..cctor () [0x00010] in <6b601bb3cfca434998e9c907b07b19b9>:0

When i downgrade the package to the stable version than this issue is gone. (I'm using the beta version because of issues with support for nullable enums in the stable version)

I have tried to manually include the x86/x64 e_sqlite3.dll to the root of the bin folder but that didn't make any difference.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the NUnit 3 failure on macOS with sqlite-pcl-net 1.5.166-beta, then inspect SQLite.SQLiteConnection, SQLitePCL.Batteries_V2.Init, and the SQLitePCL.SQLite3Provider_e_sqlite3 entry point shown in the trace. Done means the beta package loads e_sqlite3 on macOS and the test runs without DllNotFoundException while retaining nullable-enum support.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.