Skip to content

Automatically marshal COM outputs as WinRT - #1771

Draft
jevansaks wants to merge 5 commits into
mainfrom
user/jevansa/com-out-ptr-marshalling-policy
Draft

Automatically marshal COM outputs as WinRT#1771
jevansaks wants to merge 5 commits into
mainfrom
user/jevansa/com-out-ptr-marshalling-policy

Conversation

@jevansaks

@jevansaks jevansaks commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Automatically projects recognized COM IID/void** outputs through C#/WinRT when the returned identity implements IInspectable, with COM fallback on E_NOINTERFACE.
  • Enables the behavior by default and adds the comInterop.autoWinRTMarshalling opt-out.
  • Supports flat P/Invoke, generated COM RCW and CCW paths, built-in COM, null output, and Native AOT.
  • Returns the exact sibling-riid interface from managed COM implementations through coordinated IID and object marshallers.
  • Documents the selected architecture under docs/design.

Validation

  • Full warning-as-error build and package creation.
  • 1,650 non-hardware tests passed.
  • 68 hardware-dependent tests passed.
  • Native AOT package-consumption publish and runtime validation passed.
  • Adversarial COM ownership and ABI review found no defects.

Design: #1770

ADO bug: https://dev.azure.com/microsoft/OS/_workitems/edit/63185687

Generated with Copilot CLI, model: GPT-5.6 Sol.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b24622c7-c9d6-44f0-9a20-85aac5ff11d6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b24622c7-c9d6-44f0-9a20-85aac5ff11d6
@jevansaks

Copy link
Copy Markdown
Member Author

The first hardware run exposed a test-only environment dependency: SIGDN_NORMALDISPLAY returned win on Windows Server (extensions hidden) instead of win.ini. Commit d26630d now asserts the stable SIGDN_FILESYSPATH; the focused test passes in Release on .NET 9 and .NET 10.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b24622c7-c9d6-44f0-9a20-85aac5ff11d6
@jevansaks jevansaks changed the title Add COM output pointer marshalling policies Automatically marshal COM outputs as WinRT Jul 31, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b24622c7-c9d6-44f0-9a20-85aac5ff11d6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b24622c7-c9d6-44f0-9a20-85aac5ff11d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant