Skip to content

Dynamic registrar aborts for signatures with IntPtr instead of an NSObject subclass #15708

@spouliot

Description

@spouliot

This seems like a corner-case: the dynamic registrar gets the signature from native code, which says that the method returns an id, and then we've bound it as an IntPtr, and the dynamic registrar doesn't know how to return a native id given a managed IntPtr. Looking at the code I'm not sure it ever worked (fwiw it works fine if native code does not define the signature).
#15677 (comment)

Steps to Reproduce

  1. See [iOS 16][Xamarin/net6] Overriding UITextField.SelectedTextRange crashes the app #15677
  2. Build for simulator -> crash
  3. Enable the static registrar -> works

Expected Behavior

The same application code should work, identically, for both the static and dynamic registrar.

Actual Behavior

The dynamic registrar aborts.

Xamarin.iOS: Don't know how to marshal a return value of type 'System.IntPtr'. Please file a bug with a test case at https://github.com/xamarin/xamarin-macios/issues/new

This means using IntPtr cannot be a workaround without requiring the static registrar, which has a large build time impact for the simulator.

Environment

  • xamarin-macios main
  • Xcode 14 beta 5
  • iOS 16 beta 5/6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions