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!


By Luke Alderton at 22 Nov 2016, 13:16 PM

Tags: SQL,SQLite,Xamarin,PCL

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 dipbleds on Raspberry Pi - Bluetooth using Bluecove on Raspbian
12 Dec 2017, 21:29 PM
By Ich on Replacing the Xamarin Header/Navigation bar with a custom view/template
26 Nov 2017, 17:11 PM
By Ravi Motha on My experience at Umbraco UK Festival 2017
12 Dec 2017, 08:39 AM
By Borges on How to add a Xamarin Forms Loading Screen/Overlay
7 Nov 2017, 19:11 PM
By Rutul Mehta on Auto/Custom height on Xamarin Forms WebView for Android and iOS
4 Nov 2017, 03:15 AM
By Pablo on Xamarin MasterDetailPage has large margin/padding at top
26 Oct 2017, 15:31 PM
By faiza on Using MaryTTS or OpenMary in Java
22 Oct 2017, 12:54 PM
By Nietoperz on Using MaryTTS or OpenMary in Java
29 Sep 2017, 14:34 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development