Xamarin limitations

Microsoft.Data.Sqlite targets .NET Standard 2.0 and is supported on Xamarin. The following table shows which platforms the default SQLitePCLRaw bundle provides native SQLite binaries for. See Custom SQLite versions for details on using a different bundle or providing your own native SQLite binaries.

Platform SQLite binaries
Xamarin.Android
    arm64-v8a
    armeabi-v7a
    x86
    x86_64
Xamarin.iOS
Xamarin.Mac
Xamarin.TVOS
UWP
    arm
    arm64
    x64
    x86

iOS

Microsoft.Data.Sqlite tries to automatically initialize SQLitePCLRaw bundles. Unfortunately, because of limitations in the ahead-of-time (AOT) compilation for Xamarin.iOS, the attempt fails and you get the following error.

You need to call SQLitePCL.raw.SetProvider(). If you're using a bundle package, this is done by calling SQLitePCL.Batteries.Init().

To initialize the bundle, add the following line of code to your app before using Microsoft.Data.Sqlite.

SQLitePCL.Batteries_V2.Init();

See also