Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net9 causing Could not find the type 'ObjCRuntime.__Registrar__ #22071

Open
tj-devel709 opened this issue Jan 28, 2025 · 3 comments
Open

.Net9 causing Could not find the type 'ObjCRuntime.__Registrar__ #22071

tj-devel709 opened this issue Jan 28, 2025 · 3 comments

Comments

@tj-devel709
Copy link
Contributor


Issue moved from dotnet/maui#27312


From @natevarghese on Thursday, January 23, 2025 6:18:01 PM

Description

After updating all my projects to .NET 9, I encountered the following error when trying to access a custom Objective-C binding library, which is referenced by the iOS project. The issue only occurs on a physical iOS device:

Error:
Could not find the type 'ObjCRuntime.Registrar' in the assembly.

Following suggestions, I added the recommended configuration to one or more of the referenced projects, as described in the release notes:

Source: Xamarin .NET 9 Release Notes - Type Registrar

<Target Name="SelectStaticRegistrar" AfterTargets="SelectRegistrar">
  <PropertyGroup Condition="'$(Registrar)' == 'managed-static'">
    <Registrar>static</Registrar>
  </PropertyGroup>
</Target>

After making this change, the app crashes immediately on startup, preventing me from obtaining a stack trace. I'm unsure how to proceed. I’ve added the snippet to the iOS project, the binding library project(s), and every possible combination of them, but the issue persists.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.0 GA

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

8.0.3 GA

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No workarounds known

Relevant log output

@tj-devel709
Copy link
Contributor Author


Issue moved from dotnet/maui#27312


From @Ying-6 on Friday, January 24, 2025 9:09:39 AM

Could you provide a simple reproduction project for us to investigate it further? Looking forward to your reply!

@tj-devel709
Copy link
Contributor Author


Issue moved from dotnet/maui#27312


From @natevarghese on Saturday, January 25, 2025 10:10:52 AM

Please use this as a test repo. It has the objc bindings already so it's quite large but not a lot of code is required to reproduce it.
https://github.com/natevarghese/Solution1

As a reminder it only crashes on physical iOS devices, so you will need to update the bundle identifier to one you have provisioned.

@tj-devel709
Copy link
Contributor Author

Hi, moving the issue here. Let me know if this one should be in the Maui Issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant