Skip to content

[Breaking Change] Change CreateObjectFlags.Unwrap to only unwrap wrappers from the target ComWrappers instance #86189

Description

@jkoritzinsky

Today, calling GetOrCreateObjectFromComInstance on a ComWrappers instance with the CreateObjectFlags.Unwrap flag will unwrap a ManagedObjectWrapper from any ComWrappers instance. We propose changing this behavior to only unwrap wrappers from the ComWrappers instance that GetOrCreateObjectFromComInstance was called on.

Currently, the Unwrap flag is the only API that reaches "across" ComWrappers instances, so its behavior is unintuitive. Additionally, we just released an API on ComWrappers called TryGetObject that will unwrap a COM object from any ComWrappers instance.

The existing behavior is blocking #86177.

We see this breaking change as having minimal risk as the only OSS consumer of the API outside of dotnet/runtime is dotnet/winforms, and that usage is already written to expect the new behavior (and would fail with the existing behavior if it was ever hit). This search was done with https://grep.app/search?q=CreateObjectFlags.Unwrap, and a similar search on GitHub's code search showed identical results.

Additionally, since we have ComWrappers.TryGetObject, we believe we have an easy migration path for anyone who is expecting the existing behavior.

Activity

  1. added this to the 8.0.0 milestone on May 12, 2023
  2. ghost added
    needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet
    on May 12, 2023
  3. added
    blockingMarks issues that we want to fast track in order to unblock other important work
    on May 12, 2023
  4. self-assigned this
    on May 13, 2023
  5. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on May 13, 2023
  6. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on May 15, 2023
  7. ghost locked as resolved and limited conversation to collaborators on Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Runtime.InteropServicesblockingMarks issues that we want to fast track in order to unblock other important workbreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions