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__ #27312

Closed
natevarghese opened this issue Jan 23, 2025 · 3 comments
Closed

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

natevarghese opened this issue Jan 23, 2025 · 3 comments
Labels
platform/iOS 🍎 t/bug Something isn't working

Comments

@natevarghese
Copy link

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

@natevarghese natevarghese added the t/bug Something isn't working label Jan 23, 2025
@Ying-6
Copy link

Ying-6 commented Jan 24, 2025

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

@natevarghese
Copy link
Author

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
Member

This issue was moved to dotnet/macios#22071

@dotnet dotnet locked and limited conversation to collaborators Jan 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants