Closed beeradmoore closed 1 year ago
VERY nice bug report.
I'm looking into it.
Hmmm. Your repro sample works for me. :-) From the command line anyway.
Can you try running it from the command line, just to see if this is one of those cases where it works from dotnet run
but not from inside the IDE?
Can confirm dotnet run
works, IDE still does not.
% dotnet run --framework net6.0-maccatalyst The launch profile "(Default)" could not be applied. A usable launch profile could not be located.
Does this make it an IDE bug I need to go file over there or possibly a MAUI bug to go file over there?
Well it looks like an IDE bug, but I couldn't rule out the possibility that I've got something broken that just happens to be IDE-specific.
Ah I see. Let me know if there is anything else I can do or if/when you want me to go report it to the VS team.
I get the (presumably) same crash in a "classic" Xamarin.Mac app (no .NET6) - same stack trace.
System.DllNotFoundException has been thrown
e_sqlite3 assembly:<unknown assembly> type:<unknown type> member:(null)
I've reported this before here with a workaround that seems to work, but it didn't get any traction.
@tipa There are many different ways to get a DllNotFoundException -- your problem appears to be very different from the one in this issue.
One big difference is that in the original problem at the top of this issue, the DLL not found is "sqlite3" (the System-installed SQLite library), but in your case it is "e_sqlite3" (the custom builds I include with packages).
The other weird thing about this issue is that it appears to only happen in the IDE.
Now, let's talk about your problem for a moment. First of all, it appears you tagged me over in the other issue and I missed it -- my apologies.
Your problem is more likely a bug in SQLitePCLRaw and its dependencies. However, it's quite possible that the combination of Xamarin.macOS and arm64 is one case I simply didn't get right.
I'm going to open a separate issue here for that possible problem.
From over in #497, @richardschoen : To confirm, that your problem is this one, I need the actual error message, which nuget packages you are using, etc.
VS for Mac 17.3 will support .NET MAUI. Current version is 17.0
Double checked and I get the same issue on the latest VS for Mac 17.3 preview.
I just wanted to "confirm" that I have the same issue with VS Mac preview 17.3, where the project crashes when built and deployed by VS and works when built through the CLI.
Also, would it be possible to change the Project SDKs from "Xamarin.Legacy.Sdk" to "Microsoft.NET.Sdk"? That would just be a convenience item, as my projects (net6.0) generate several build warnings regarding the possible "incompatibility issues when MacCatalyst projects depend on Xamarin.iOS projects. (NU1703)"
Most people said to do this but LinkDescription is no longer a Build action option from what I've seen
For me the SQLiteMAUITest.zip Repro does work on my Mac with the latest VS. Full information of my system:
Visual Studio Community 2022 for Mac Preview
Version 17.4 Preview (17.4 build 715)
Installation UUID: d3a415a0-815f-4d2a-b4f2-68876eb19e2f
Runtime
.NET 6.0.5 (64-bit)
Architecture: X64
Roslyn (Language Service)
4.4.0-1.22371.1+c07f2571612b471671c809b5b0db59b0c37aab57
NuGet
Version: 6.2.1.2
.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Version: 6.0.400
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 6.0.8
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Xamarin.Android
Version: 13.0.99.36 (Visual Studio Community)
Commit: xamarin-android/main/b4998c8
Android SDK: /Users/home/Library/Android/sdk
Supported Android versions:
12.0 (API level 31)
8.1 (API level 27)
11.0 (API level 30)
7.1 (API level 25)
SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.1
SDK Build Tools Version: 32.1.0 rc1
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:27:22 UTC
Android Device Manager
Version: 0.0.0.1179
Hash: 0f220c0
Branch: main
Build date: 2022-08-04 16:27:22 UTC
Xamarin Designer
Version: 17.4.0.32
Hash: 439b92ed7b
Branch: remotes/origin/d17-4
Build date: 2022-08-04 16:27:17 UTC
Apple Developer Tools
Xcode 13.3 (20102)
Build 13E113
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:24:56+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:07:25 PDT 2022
root:xnu-8020.140.41~1/RELEASE_X86_64 x86_64
Also confirming I run through on current 17.3 stable and current 17.4 preview. MAUI development is recommended to be on 17.4 preview but did the test on both, from what I can tell on Twitter the previous MAUI stuff in 17.3 preview is now in 17.3 stable and 17.4 preview so far has very minimal changes.
Tested on debug iOS (iOS 16 beta 5), debug+release on macOS 12.5. Worked fine. Seems to be fixed so will be closing.
Anyone who face the same problem and already updated to Visual Studio for Mac 17.4 you need the following nuget library:
sqlite-net-pcl version 1.8.116
SQLitePCLRaw.bundle_green version at least 2.1.0
If you just install sqlite-net-pcl, the default version of SQLitePCLRaw.bundle_green came with it is still not enough.
Issue
Crash when running .NET MAUI application on macOS.
Repro:
SQLiteMAUITest.zip
Project
I've taken the standard .NET MAUI template and added SQLite to try add a local DB cache. In this example I added
sqlite-net-pcl
. Based on some other issues I realised I needed to installSQLitePCLRaw.bundle_green
to at least v2.1.0 (which conveniently went full release just yesterday). It looks likesqlite-net-pcl
has a dependency on v2.0.4 but that gave me different issues on other platforms.All the code related to the database is in
MainPage.xaml.cs
. I just load the entry from the db. When user taps the the button we update the db record.I have tested this and it appears to work on :
I am unable to deploy debug/release to my iOS device.
It does not work when I deploy as a macOS app. I am unsure if this is because it is running as a Mac Catalyst app.
I also have this nuget warning but I am unsure if it is 100% related to the main problem that is happening.
Attempted Workaround
Looking into some older issues I thought maybe if I add the native library so I added
SQLitePCLRaw.lib.e_sqlite3.osx
but it also failed with the same error.Additional information
I am using the latest non-beta macOS 12.4, the latest stable MAUI, the latest stable VS4Mac, latest .NET 6.0 SDK.
Detailed system information π
``` Visual Studio Community 2022 for Mac Version 17.0 (build 8989) Installation UUID: 4ee827da-73c9-408a-b91f-216db80a725a Runtime .NET 6.0.3 (64-bit) Architecture: X64 Roslyn (Language Service) 4.1.0-3.22075.3+592501cbb9c9394072a245c15b3458ff88155d85 NuGet Version: 6.0.0.262 .NET SDK (x64) SDK: /usr/local/share/dotnet/sdk/6.0.300/Sdks SDK Versions: 6.0.300 6.0.202 6.0.201 6.0.200 6.0.105 6.0.102 6.0.101 5.0.408 5.0.407 5.0.406 5.0.405 5.0.404 5.0.403 5.0.402 5.0.401 5.0.400 5.0.302 5.0.301 5.0.203 5.0.202 5.0.201 5.0.200 5.0.103 5.0.102 5.0.101 3.1.419 3.1.418 3.1.417 3.1.416 3.1.415 3.1.414 3.1.413 3.1.412 3.1.411 3.1.410 3.1.409 3.1.408 3.1.407 3.1.406 3.1.405 3.1.404 MSBuild SDKs: /usr/local/share/dotnet/sdk/6.0.300/Sdks .NET Runtime (x64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 5.0.17 5.0.16 5.0.15 5.0.14 5.0.13 5.0.12 5.0.11 5.0.10 5.0.9 5.0.8 5.0.7 5.0.6 5.0.5 5.0.4 5.0.3 5.0.2 5.0.1 3.1.25 3.1.24 3.1.23 3.1.22 3.1.21 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 Xamarin.Profiler Version: 1.8.0.19 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Xamarin.Android Version: 12.3.0.3 (Visual Studio Community) Commit: xamarin-android/d17-2/bbba5a2 Android SDK: /Users/bradmoore/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 12.0 (API level 31) 11.0 (API level 30) 10.0 (API level 29) SDK Command-line Tools Version: 5.0 SDK Platform Tools Version: 31.0.3 SDK Build Tools Version: 30.0.3 Build Information: Mono: adf1bc4 Java.Interop: xamarin/java.interop/d17-2@9760f0a9 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.38.2@7b1e016 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac 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.2.0.37 Hash: 7f5a6ef Branch: remotes/origin/d17-2 Build date: 2022-05-18 17:27:49 UTC Android Device Manager Version: 0.0.0.1116 Hash: e47e6c8 Branch: remotes/origin/d17-2 Build date: 2022-05-18 17:27:49 UTC Apple Developer Tools Xcode 13.4 (20503) Build 13F17a Xamarin.Mac Version: 8.10.0.1 (Visual Studio Community) Hash: 568bdb24e Branch: d17-2 Build date: 2022-04-08 18:52:56-0400 Xamarin.iOS Version: 15.10.0.1 (Visual Studio Community) Hash: 568bdb24e Branch: d17-2 Build date: 2022-04-08 18:52:57-0400 Xamarin Designer Version: 17.1.5.90 Hash: 53f47efde Branch: remotes/origin/d17-0-vsmac Build date: 2022-05-18 17:27:43 UTC Build Information Release ID: 1700008989 Git revision: 55998773faa2cb1dda7aab5fecd1625f7b664d10 Build date: 2022-05-18 17:25:21+00 Build branch: release-17.0 Build lane: release-17.0 Operating System Mac OS X 12.4.0 Darwin 21.5.0 Darwin Kernel Version 21.5.0 Tue Apr 26 21:08:22 PDT 2022 root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64 ```