Skip to content

Add support for multiple managed instances for the same native handle #7442

Description

@rolfbjarne

Currently our runtime will try its best to make sure there's only a single managed instance for each native handle, and this is assumed in several places in the code base.

Unfortunately, we break this assumption ourselves in a couple of places:

We might have to add complete support for having multiple managed instances for the same native handle.

This would probably mean we'd have to make our IntPtr->INativeObject dictionary an IntPtr->List<INativeObject> dictionary instead. There could be one "main" mapping (whose managed type is determined by the runtime type of the native object, and returned when the caller doesn't know the managed type it wants - Runtime.GetNSObject), and then a list of other instances where the managed type is of a particular type.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue or pull request is an enhancementiOSIssues affecting iOSmacOSIssues affecting macOS

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions