ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

Sqllite crashes in iOS simulator but not android when running a new Maui app #502

Closed julianadormon closed 1 year ago

julianadormon commented 1 year ago

Thanks in advance. Hoping you may help.

I have a Maui app which targets Android and IOS. The app build and debugs fine in Android but fails in IOS.

The error is: {System.DllNotFoundException: e_sqlite3 at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number() at SQLitePCL.raw.SetProvider(ISQLite3Provider imp) at SQLitePCL.Batteries_V2.Init() at System.Reflection.RuntimeMet…}

This appears similar to the closed issue, https://github.com/ericsink/SQLitePCL.raw/issues/468 however, I have the latest VisualStudio and nugget packages installed.

I also tried running from the terminal using dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=0B8BF9E6-58A1-430F-A8EB-0E8B421193A9 but the error is the same.

My DbClassLibrary references: Microsoft.EntityFrameworkCore 6.0.8 Microsoft.EntityFrameworkCore.Design 6.0.8 Microsoft.EntityFrameworkCore.Sqlite 6.0.8 Microsoft.EntityFrameworkCore.Tools 6.0.8

My project references: Microsoft.EntityFrameworkCore 6.0.8 Microsoft.EntityFrameworkCore.Design 6.0.8 Microsoft.EntityFrameworkCore.Sqlite 6.0.8

Visual Studio Community 2022 for Mac Preview Version 17.4 Preview (17.4 build 715) Installation UUID: a15d9019-0920-431a-9d44-6be60ab43264

Runtime .NET 6.0.5 (64-bit) Architecture: Arm64

Roslyn (Language Service) 4.4.0-1.22371.1+c07f2571612b471671c809b5b0db59b0c37aab57

NuGet Version: 6.2.1.2

.NET SDK (Arm64) SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks SDK Versions: 6.0.400 6.0.400-preview.22330.6 MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET SDK (x64) SDK Versions: 5.0.408 3.1.422 3.1.421

.NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 6.0.8 6.0.6

.NET Runtime (x64) Runtime: /usr/local/share/dotnet/x64/dotnet Runtime Versions: 5.0.17 3.1.28 3.1.27

Xamarin.Profiler Version: 1.8.0.19 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater Version: 11

Apple Developer Tools Xcode 13.4.1 (20504) Build 13F100

Xamarin.Android Version: 13.0.99.36 (Visual Studio Community) Commit: xamarin-android/main/b4998c8 Android SDK: /Users/macminim1/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 12.0 (API level 31)

SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 33.0.2 SDK Build Tools Version: 33.0.0

Build Information: Mono: dffa5ab Java.Interop: xamarin/java.interop/main@032f1e71 SQLite: xamarin/sqlite/3.39.2@40e8743 Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9c641b3

Microsoft Build of OpenJDK Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk 11.0.12 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk 1.8.0.302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager Version: 17.4.0.24 Hash: b3b6672 Branch: remotes/origin/HEAD~1 Build date: 2022-08-04 16:29:21 UTC

Android Device Manager Version: 0.0.0.1179 Hash: 0f220c0 Branch: main Build date: 2022-08-04 16:29:21 UTC

Xamarin Designer Version: 17.4.0.32 Hash: 439b92ed7b Branch: remotes/origin/d17-4 Build date: 2022-08-04 16:29:17 UTC

Xamarin.Mac Version: 8.12.0.2 (Visual Studio Community) Hash: 87f98a75e Branch: d17-3 Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS Version: 15.12.0.2 (Visual Studio Community) Hash: 87f98a75e Branch: d17-3 Build date: 2022-07-25 20:18:55-0400

Build Information Release ID: 1704000715 Git revision: 09071dadfc1b81e4f0e2c9505cd8a5ef0b41d312 Build date: 2022-08-04 16:26:39+00 Build branch: release-17.4 Build lane: release-17.4

Operating System Mac OS X 12.5.0 Darwin 21.6.0 Darwin Kernel Version 21.6.0 Sat Jun 18 17:05:47 PDT 2022 root:xnu-8020.140.41~1/RELEASE_ARM64_T8101 arm64

Screen Shot 2022-08-09 at 10 50 09 PM

Screen Shot 2022-08-09 at 11 01 45 PM

ericsink commented 1 year ago

I can't quite figure out what's happening here.

Can you clarify whether this is in the simulator on the device? Your subject line says simulator, but some of the other info here suggests a device.

OTOH, the failure happens in provider_e_sqlite3, and device builds don't use that.

The presence of Blazor packages in an iOS project raises an eyebrow as well.

Would it be possible for you to post a minimal repro sample project?

julianadormon commented 1 year ago

Thanks @ericsink .

I am using a Maui/Blazor set up. I was debugging to an iOS simulator. I have created a new Maui app which is now debugging directly to a mac catalyst app and I am still getting the same error.

I am playing with a few things. If I can't get this to work, I will put together a repo for you.

Thanks.

julianadormon commented 1 year ago

Hi @ericsink I apologize for wasting your time. I was able to figure it out. I was using an incorrect implementation.