Skip to content

[.NET 9] iOS notification app extensions #21606

@dottam

Description

@dottam

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

  1. Change the bundle identifier in the Info.plist for the notificationTest, notificationService and notificationContent sample projects to match your provisioning profile
  2. Build the project
    dotnet build notificationTest/notificationTest.csproj -c Debug -p:Platform="iPhone" -p:RuntimeIdentifier="ios-arm64"
  3. Install and launch the app on device
  4. Tap "Send Local Notification" button
  5. Long pressed the notification to show details

Observe logs from Console app

Did you find any workaround?

Sets the TargetFramework to net8.0-ios in the following projects

  • notificationContent/notificationContent.csproj
  • notificationService/notificationService.csproj

Relevant 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<…>

Metadata

Metadata

Assignees

Labels

bugIf an issue is a bug or a pull request a bug fixregressionThe issue or pull request is a regression

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions