SQLitePCL.raw: .net MAUI apps crash on iOS with Visual Studio 2022 v17.1 Preview 4

We’re building an app using the previews of .net MAUI (specifically for maui-blazor). Trying to test the app on iOS results in a crash when initializing SQLite. We are using Entity Framework 6.0.1.

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1" />

[0:] An error occurred: ‘e_sqlite3’. Callstack: ’ at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number() at SQLitePCL.raw.SetProvider(ISQLite3Provider imp) at SQLitePCL.Batteries_V2.Init()

We’re using Visual Studio 2022 v17.1 Preview 4

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

I think the issues herein got fixed and are part of the 2.1.0 release, now on nuget.

the app works on iOS but crashes on maccatalyst

Preview release 2.1.0-pre20220207221914 has been pushed up to nuget.org. It contains attempted fixes for this issue. Testing feedback would be appreciated.

@ericsink ok, great finding. But if you want to run that app on iOS simulator with that command dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=A0859D94-CDC2-45D3-BDA8-7E5C85F76975 runs ok? I tried this few days ago with no luck…

The wrong instance of SQLitePCLRaw.batteries_v2.dll is ending up chosen. I am not sure why this is happening. The right one is in the nuget under lib\Xamarin.iOS10, but the one under lib\netstandard2.0 is being chosen instead.

I have local nupkgs for the current development work I am doing with SQLitePCLRaw. If I update the bundle_green reference to my current builds, the problem is fixed. I presume this is because that version of bundle_green has a batteries assembly in lib\net6.0-ios15.

The diagnostic build output seems to indicate that the build knows that Xamarin.iOS10 is the older form of net6.0-ios, so I’m still not sure why the problem is happening.

I can reproduce the error now, but I do not yet understand why it is happening.