IOS MAUI .net "9.0" System.Data.Sqlite does not work and give Exception = e_Sqlite3

waqas ahmed 0 Reputation points
2025-12-10T06:45:48.9866667+00:00

SQLite in MAUI App not working on iOS. I need to use System.Data.Sqlite for low level db operations. But I was unable to Open connection on IOS simulator.

I tried every combination of SqlitePCLRaw libraries and below is my current packages added

<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />

<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />

<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.8" />

<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />

<PackageReference Include="SQLiteNetExtensions.Async" Version="2.1.0" />

<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.11" />

<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />

<PackageReference Include="SQLitePCLRaw.core" Version="2.1.11" />

<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.11" />

<PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.11" />

<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.11" />

<PackageReference Include="System.Data.SQLite" Version="2.0.2" />

<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.10" />

But still, it does not seem to work and always give Exception on conn = new SQLiteConnection(connStr);

Exception Message = e_sqlite3 nothing else

It was previously Xamarin based Application built for both Android and IOS. It was using Mono.Data.Sqlite.Portable for db operations and was working fine. But now Application is migrated to Multi Project MAUI Application using .net 9.0 The specific db operations for which I need System.Data.Sqlite for are listed below SQLiteDataAdapter SQLiteCommandBuilder to load Datatable and get Columns information one by one to copy Data from one table to another

Thanks

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Adiba Khan 1,440 Reputation points Microsoft External Staff
    2025-12-11T08:28:27.6266667+00:00

    Thank you for reaching out. This behavior is expected due to recent platform changes in.net for iOS .

    Root Cause

    System.Data.SQLite is not supported on iOS under .NET 7/8/9 because:

    1. iOS uses AOT (Ahead-of-time) compilation and
    2. System.Data.SQLite depends on native dynamic loading (dlopen) which iOS explicitly blocks for security.

    As a result, the SQLite native library cannot load, producing the runtime error:

    e_sqlite3
    

    Even when adding multiple SQLitePCLRaw bundles, the underlying unmanaged dependency required by System.Data.SQLite still cannot load on iOS.

    This is why the same code worked in Xamarin (which used MonoJIT) but fails after migration to .NET 9 MAUI.

    Recommended solution

    To use SQLite reliably on iOS, Android, Windows and MacCatalyst, Microsoft recommends switching to: SQLite-net (sqlite-net-pcl)

    Or EF Core SQLite

    These packages embed SQLite using SQLitePCLRaw.bundle_green which is fully compatible with iOS AOT.

    Recommended package setup:

    <PackageReference include="sqlite-net-pcl" Version="1.9.172" />
    <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />
    

    Remove all the following (they cause conflicts):

    • System.Data.SQLite
    • SQLitePCLRaw.bundle_e_sqlite3
    • SQLitePCLRaw.provider.dynamic_*
    • Any other SQLite native providers

    Reference:

    Please let us know if you require any further assistance we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". 

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.