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 Raymondpef on MVC forms in Umbraco
20 Nov 2018, 23:58 PM
By svetikNoupt on MVC forms in Umbraco
20 Nov 2018, 19:44 PM
By Lestersep on MVC forms in Umbraco
17 Nov 2018, 13:55 PM
By nseo-sw.men on MVC forms in Umbraco
17 Nov 2018, 00:43 AM
By shale.larosh on MVC forms in Umbraco
16 Nov 2018, 22:34 PM
By EdwardPhova on MVC forms in Umbraco
16 Nov 2018, 12:40 PM
By svetikNoupt on MVC forms in Umbraco
13 Nov 2018, 22:04 PM
By nseo-sw.men on MVC forms in Umbraco
13 Nov 2018, 17:47 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development