-
Notifications
You must be signed in to change notification settings - Fork 516
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
[.NET 9] iOS notification app extensions #21606
Comments
Can you try adding this to the csproj to see if that works around it? <PropertyGroup>
<Registrar>static</Registrar>
</PropertyGroup> |
setting |
It's a workaround, we'll fix it so that it works without it (although I'm not sure right now when that might be). |
Just for reference and to not lose the track of it. |
This is a workaround for #21606, until the managed static registrar is fixed to work with app extensions.
This is a workaround for #21606, until the managed static registrar is fixed to work with app extensions.
…static registrar. Fixes #21606. If an assembly only required the lookup tables from the managed static registrar (and not any other code), we wouldn't save those changes. This would lead to a runtime exception: ``` Microsoft.iOS: Processing Objective-C exception for exception marshalling (mode: 2): Could not find the type 'ObjCRuntime.__Registrar__' in the assembly 'X.Y.Z'. (ObjCRuntime.RuntimeException) at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 105 at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 93 at ObjCRuntime.RegistrarHelper.LookupRegisteredType(Assembly assembly, UInt32 id) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 199 at ObjCRuntime.Class.ResolveToken(Assembly assembly, Module module, UInt32 token) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 521 ``` The fix is to save the assembly if the managed static registrar added lookup tables to the assembly. Fixes #21606.
…static registrar. Fixes #21606. If an assembly only required the lookup tables from the managed static registrar (and not any other code), we wouldn't save those changes. This would lead to a runtime exception: ``` Microsoft.iOS: Processing Objective-C exception for exception marshalling (mode: 2): Could not find the type 'ObjCRuntime.__Registrar__' in the assembly 'X.Y.Z'. (ObjCRuntime.RuntimeException) at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 105 at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 93 at ObjCRuntime.RegistrarHelper.LookupRegisteredType(Assembly assembly, UInt32 id) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 199 at ObjCRuntime.Class.ResolveToken(Assembly assembly, Module module, UInt32 token) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 521 ``` The fix is to save the assembly if the managed static registrar added lookup tables to the assembly. Fixes #21606.
I can reproduce the problem, and a fix is in progress. |
…de by the managed static registrar. Fixes #21606. (#21638) If an assembly only required the lookup tables from the managed static registrar (and not any other code), we wouldn't save those changes. This would lead to a runtime exception: ``` Microsoft.iOS: Processing Objective-C exception for exception marshalling (mode: 2): Could not find the type 'ObjCRuntime.__Registrar__' in the assembly 'X.Y.Z'. (ObjCRuntime.RuntimeException) at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 105 at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 93 at ObjCRuntime.RegistrarHelper.LookupRegisteredType(Assembly assembly, UInt32 id) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 199 at ObjCRuntime.Class.ResolveToken(Assembly assembly, Module module, UInt32 token) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 521 ``` The fix is to save the assembly if the managed static registrar added lookup tables to the assembly. Fixes #21606. Backport of #21637 --------- Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Apple platform
iOS
Framework version
net9.0-*
Affected platform version
.NET 9.0.100 / iOS MAUI 18.0.9617/9.0.100
Description
The iOS notification extensions does not work as expected in .NET 9, tested on iPhone 12 iOS 18.0.1
Sample project
notification.zip
.NET information
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.c6f19616
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.1
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.100/
.NET workloads installed:
[maui-ios]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.0/WorkloadManifest.json
Install Type: FileBased
[ios]
Installation Source: SDK 9.0.100
Manifest Version: 18.0.9617/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.ios/18.0.9617/WorkloadManifest.json
Install Type: FileBased
[maui]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.sdk.maui/9.0.0/WorkloadManifest.json
Install Type: FileBased
Steps to Reproduce
dotnet build notificationTest/notificationTest.csproj -c Debug -p:Platform="iPhone" -p:RuntimeIdentifier="ios-arm64"
Observe logs from Console app
Did you find any workaround?
Sets the
TargetFramework
tonet8.0-ios
in the following projectsRelevant logs
Logs from Console app:
*** Terminating app due to uncaught exception 'ObjCRuntime.RuntimeException', reason: 'Could not find the type 'ObjCRuntime.Registrar' in the assembly 'NotificationTest.NotificationContent'. (ObjCRuntime.RuntimeException)
at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName)
at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly)
at ObjCRuntime.RegistrarHelper.LookupRegisteredType(Assembly assembly, UInt32 id)
at ObjCRuntime.Class.ResolveToken(Assembly assembly, Module module, UInt32 token)
at ObjCRuntime.Class.ResolveFullTokenReference(UInt32 token_reference)
at ObjCRuntime.Class.ResolveTokenReference(UInt32 token_reference, UInt32 implicit_token_type)
at ObjCRuntime.Class.ResolveTypeTokenReference(UInt32 token_reference)
at ObjCRuntime.Class.FindType(NativeHandle class, Boolean& is_custom_type)
at ObjCRuntime.Class.Lookup(IntPtr klass, Boolean throw_on_error)
at ObjCRuntime.Class.Lookup(IntPtr klass)
at ObjCRuntime.Runtime.ConstructNSObject(IntPt<…>
Received unhandled Objective-C exception that was marshalled from a managed exception: Could not find the type 'ObjCRuntime.Registrar' in the assembly 'NotificationTest.NotificationContent'. (ObjCRuntime.RuntimeException)
at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName)
at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly)
at ObjCRuntime.RegistrarHelper.LookupRegisteredType(Assembly assembly, UInt32 id)
at ObjCRuntime.Class.ResolveToken(Assembly assembly, Module module, UInt32 token)
at ObjCRuntime.Class.ResolveFullTokenReference(UInt32 token_reference)
at ObjCRuntime.Class.ResolveTokenReference(UInt32 token_reference, UInt32 implicit_token_type)
at ObjCRuntime.Class.ResolveTypeTokenReference(UInt32 token_reference)
at ObjCRuntime.Class.FindType(NativeHandle class, Boolean& is_custom_type)
at ObjCRuntime.Class.Lookup(IntPtr klass, Boolean throw_on_error)
at ObjCRuntime.Class.Lookup(IntPtr klass)
at ObjCRuntime.Runtime.ConstructNSObject(IntPt<…>
The text was updated successfully, but these errors were encountered: