The type initializer for 'SQLite.SQLiteConnection' threw an exception

I hate to put myself in the "I don't know how I fixed it" boat, but that's what happened. I started clean and copy+pasted the code and repulled Nuget packages and everything just worked. Maybe I overlooked something initially, maybe had a version mismatch, I cannot say. However, I tried adding the dependencies mentioned by Trevor and the problem still existed, so I don't think I was missing anything.


I fixed the same problem by downgrading the "sqlite-net-pcl" package to the last stable version (v1.7.302-beta → v1.6.292).


In my case, I got the error, because I was missing the "runtimes" folder in the "bin" folder of my Windows Forms application.

There should be a child-folder hierachy like this below the folder where your executable is stored:

  • runtimes\win-arm\native
  • runtimes\win-x64\native
  • runtimes\win-x86\native

In each folder, there is a "e_sqlite3.dll" file.

After I added those to the folder where my executable was located, the error went away. Actually, the files are automatically copied the the output folder if you use the appropriate SQLite NuGet packages.


I had the same problem, deleting the "bin" and "obj" folders solved it.