xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.42k stars 507 forks source link

Need help with this build error - BTOUCH : error BI0000: Unexpected error #20609

Open kenneth-y opened 1 month ago

kenneth-y commented 1 month ago

Hi,

I am creating an iOS binding library for a native library from https://github.com/FutureWorkshops/RANDA-RulesOfGolf-iOS-PodRepo.

I could not get past this error and there are no other details on why it is failing

BTOUCH : error BI0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new [/Users/kennethylaya/Projects/RANDARulesOfGolf.iOS/RANDARulesOfGolf.DotNet.Bindings/RANDARulesOfGolf.DotNet.Bindings.csproj]

Steps to Reproduce

  1. Built the native framework as described in the README from https://github.com/FutureWorkshops/RANDA-RulesOfGolf-iOS-PodRepo
  2. Create an iOS Binding library project in VS for Mac.
  3. Add a reference to the framework.
  4. Build the iOS binding library project.

Expected Behavior

Compiles successfully and creates an iOS binding library DLL that can be reference in the .NET for iOS project.

Actual Behavior

BTOUCH : error BI0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new [/Users/kennethylaya/Projects/RANDARulesOfGolf.iOS/RANDARulesOfGolf.DotNet.Bindings/RANDARulesOfGolf.DotNet.Bindings.csproj]

Environment

Version information ``` Visual Studio Professional 2022 for Mac Version 17.6.11 (build 400) Installation UUID: b30d0650-eebc-45b8-bf8f-46e856ca2184 Runtime .NET 7.0.3 (64-bit) Architecture: Arm64 Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2 Roslyn (Language Service) 4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa NuGet Version: 6.4.0.117 .NET SDK (Arm64) SDK: /usr/local/share/dotnet/sdk/7.0.315/Sdks SDK Versions: 7.0.315 7.0.314 6.0.421 6.0.420 MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks .NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 7.0.18 7.0.17 6.0.29 6.0.28 Xamarin.Profiler Version: 1.8.0.49 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Apple Developer Tools Xcode: 15.2 22503 Build: 15C500b Xamarin.Mac Not Installed Xamarin.iOS Version: 16.4.0.23 Visual Studio Professional Hash: 9defd91b3 Branch: xcode14.3 Build date: 2023-10-23 16:15:00-0400 Xamarin Designer Version: 17.6.3.9 Hash: 2648399ae8 Branch: remotes/origin/d17-6 Build date: 2024-04-05 09:48:23 UTC Xamarin.Android Version: 13.2.2.0 (Visual Studio Professional) Commit: xamarin-android/d17-5/45b0e14 Android SDK: /Users/kennethylaya/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 13.0 (API level 33) SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 34.0.3 SDK Build Tools Version: 32.0.0 Build Information: Mono: d9a6e87 Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d Microsoft Build of OpenJDK Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk 11.0.16.1 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.6.0.50 Hash: a715dca Branch: HEAD Build date: 2024-04-05 09:48:29 UTC Android Device Manager Version: 0.0.0.1309 Hash: 06e3e77 Branch: HEAD Build date: 2024-04-05 09:48:29 UTC Build Information Release ID: 1706110400 Git revision: 5d3d895c30788d39f3fb9931002e2961d22b60fd Build date: 2024-04-05 09:46:37+00 Build branch: release-17.6 Build lane: release-17.6 Operating System Mac OS X 14.4.1 Darwin 23.4.0 Darwin Kernel Version 23.4.0 Fri Mar 15 00:12:41 PDT 2024 root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 arm64 ```

Build Logs

msbuild.binlog.zip

Example Project (If Possible)

RulesOfGolf.iOS.Bindings.zip

rolfbjarne commented 1 month ago

Can you try with this ApiDefinition.cs?

ApiDefinition.cs.zip

Changes:

  1. Remove any constructors taking an NSCoder argument: these constructors are already automatically generated, so there's a duplicate member error.
  2. Don't inherit from protocols in categories (this might be a bug on our side, I'll have to investigate a bit more).
  3. Comment out ROGTabBarController.SupportedInterfaceOrientations - this is the property causing the reported exception - because it seems to conflict somehow with the definition on the base type UITabBarController (this is certainly a bug, I'll investigate this too).
rolfbjarne commented 1 month ago

Note to self: test cases implemented here: https://github.com/rolfbjarne/xamarin-macios/commit/b4ecdad02a67a7600a18aee571dece418ecf223b

kenneth-y commented 1 month ago

@rolfbjarne Thanks for your feedback and sending the updated ApiDefinition.cs file. The iOS bindings project compiles successfully now but I can't seem to use the library on my app, it just crashes.

I have created a simple .NET iOS app and referenced the bindings library project but it crashes due to this runtime error (full message is in the attached text file)

nz.co.golf.mygolf: 72190 dyld[72190]: Library not loaded: @rpath/DTCoreText.framework/DTCoreText

RoG-runtime.log.txt

Is DTCoreText.framework another native library that needs a bindings library?

Also, I have attached my solution (Test app and the bindings library) for reference. Archive.zip

rolfbjarne commented 1 month ago

@rolfbjarne Thanks for your feedback and sending the updated ApiDefinition.cs file. The iOS bindings project compiles successfully now but I can't seem to use the library on my app, it just crashes.

I have created a simple .NET iOS app and referenced the bindings library project but it crashes due to this runtime error (full message is in the attached text file)

nz.co.golf.mygolf: 72190 dyld[72190]: Library not loaded: @rpath/DTCoreText.framework/DTCoreText

The relevant text is:

Library not loaded: @rpath/DTCoreText.framework/DTCoreText
  Referenced from: [...]/RandRulesOfGolfTestApp.app/Frameworks/RANDARulesOfGolf.framework/RANDARulesOfGolf

So DTCoreText.framework is referenced from RANDARulesOfGolf.framework, and as such must also be included in the app somehow. The easiest way to do this is to add it to the same binding project as another NativeReference (unless you need to call any of the APIs in this framework from managed code, you shouldn't need to do anything else).

kenneth-y commented 2 weeks ago

Thanks @rolfbjarne - hope to get back on this next week.