roubachof / NukeProxy

MIT License
17 stars 12 forks source link

ObjCRuntime.RuntimeException: Could not find the type 'ObjCRuntime.__Registrar__' in the assembly 'ImageCaching.Nuke' #23

Open Cheesebaron opened 22 hours ago

Cheesebaron commented 22 hours ago

.NET 9 introduced a new type registrar, which seems to have broken a lot of binding libraries. See: https://github.com/xamarin/xamarin-macios/wiki/.NET-9-release-notes#type-registrar-managed-static-as-the-new-default

I released 4.0.0 targeting .NET 9 in hopes of fixing this. However, the issue persists and the App will crash with a stacktrace like this: https://gist.github.com/Cheesebaron/7b63e5ea7901320df82063a88d3df76c

To work around add this issue, you can opt out of of this registrar, see: https://github.com/xamarin/xamarin-macios/wiki/.NET-9-release-notes#opting-out

Add the following to your App's csproj file:

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

Related issue: https://github.com/xamarin/xamarin-macios/issues/21606

Cheesebaron commented 22 hours ago

@roubachof can you please pin this on the repo?