1

I'm using the sqlite-net-pcl nuget package (version 1.8.116) in a .Net framework 4.8 Winforms Application. It seems to have a .NET Standard dependency.

When running from the Visual Studio environment, the SQLite libraries initialize without any problems and the necessary read/write aspects of the libraries work as expected.

However, when deploying to a different folder, the application throws an unhandled exception. My windows event viewer provides the following information.

`Exception Info: System.Exception at SQLitePCL.NativeLibrary.Load(System.String, System.Reflection.Assembly, Int32) at SQLitePCL.Batteries_V2.MakeDynamic(System.String, Int32) at SQLitePCL.Batteries_V2.DoDynamic_cdecl(System.String, Int32) at SQLite.SQLiteConnection..cctor()

Exception Info: System.TypeInitializationException at SQLite.SQLiteConnection..ctor(SQLite.SQLiteConnectionString) at SQLite.SQLiteConnectionPool+Entry..ctor(SQLite.SQLiteConnectionString) at SQLite.SQLiteConnectionPool.GetConnectionAndTransactionLock(SQLite.SQLiteConnectionString, System.Object ByRef) at SQLite.SQLiteAsyncConnection+<>c__DisplayClass33_01[[SQLite.CreateTableResult, SQLite-net, Version=1.8.116.0, Culture=neutral, PublicKeyToken=null]].<WriteAsync>b__0() at System.Threading.Tasks.Task1[[SQLite.CreateTableResult, SQLite-net, Version=1.8.116.0, Culture=neutral, PublicKeyToken=null]].InnerInvoke() at System.Threading.Tasks.Task.Execute()

The following SQlite DLL files are in the deployment folder

SQLite-net.dll SQLitePCLRaw.batteries_v2.dll SQLitePCLRaw.nativelibrary.dll SQLitePCLRaw.provider.dynamic_cdecl.dll SQLitePCLRaw.core.dll

How to resolve this unhandled exception?

1 Answer 1

0

It seems I missed / was not aware of the additional dependencies (libraries). You will find a "runtimes" folder in your application bin folder. Within this you will find a "e_sqlite3.dll" file for each relevant system platform.

This "runtimes" folder needs to be deployed (only with the relevant platform subfolders) to your deployment directory (i.e. "next to" you windows application executable)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.