Solved: SQLite PCL TypeInitializationException

For those that get this error and just want the quick fix, here it is:

Open 'References' in your project and proceed to remove all references to SQLite from the list. Once that's done, right click the project and click 'Manage Nuget Packages...', from here, click the 'Installed' tab and then Uninstall all SQLite packages, then search for sqlite-net-pcl and install the one by 'Frank A. Krueger' this will install with it all the other dependencies for that package along with it.

But why?

As to why this has happened, I can only assume it's down to references to older versions of files or references that are no longer required getting left in the project after a package upgrade or uninstall.

Where and other thought processes

The 'TypeInitializationException' error normally happens on a line like the following:

var conn = new SQLiteConnection(path);

And this makes it look like it's a problem with the path or write access to the device but I assure you it's not. It's definitely a dependency.

Happy coding!


Published at

Tags: SQL,SQLite,Xamarin,PCL

Luke Alderton

Comments

Post a comment
Sit tight...
We're adding your comment.
Thank you.
Your comment has been added.
There's been a problem.
Please try again later.
Share with
Tags
Latest Comments
By Helenpaups on MVC forms in Umbraco
23 May 2018, 16:48 PM
By Helenpaups on MVC forms in Umbraco
23 May 2018, 13:46 PM
By AkikoTax on MVC forms in Umbraco
20 May 2018, 06:41 AM
By Klaus on MVC forms in Umbraco
17 May 2018, 10:47 AM
By Archie on MVC forms in Umbraco
16 May 2018, 18:52 PM
By w on JQuery Unobtrusive Validation for dynamically created elements
11 May 2018, 02:00 AM
By Luke on Umbraco using Global.asax to handle events before the Request Handler.
27 Apr 2018, 18:28 PM
By Janine Gardiola on Umbraco using Global.asax to handle events before the Request Handler.
26 Apr 2018, 11:18 AM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development