__ComObject doesn't support dynamic interface map (redux)#123725
Merged
AaronRobinsonMSFT merged 4 commits intodotnet:mainfrom Jan 29, 2026
Merged
__ComObject doesn't support dynamic interface map (redux)#123725AaronRobinsonMSFT merged 4 commits intodotnet:mainfrom
__ComObject doesn't support dynamic interface map (redux)#123725AaronRobinsonMSFT merged 4 commits intodotnet:mainfrom
Conversation
This was originally fixed naively which resulted in an incomplete fix. The activation path issues remained and this current fix addresses the underlying issue - adding IDIC to __ComObject.
Contributor
|
Tagging subscribers to this area: @dotnet/interop-contrib |
Contributor
There was a problem hiding this comment.
Pull request overview
Revisits the fix for COM interop casting involving System.__ComObject and the dynamic interface map, adding broader validation and updating test infrastructure to cover the previously missed scenario.
Changes:
- Updates COM test contracts and native/managed test clients to use a revised interface shape for validating COM interface casting behavior.
- Extends COM interop tests to validate the expected interfaces are present on activated COM classes.
- Refines
MethodTable::HasDynamicInterfaceMap()logic and adds explanatory comments about the dynamic interface map’s intent and usage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/Interop/COM/ServerContracts/Server.Contracts.h | Removes IInterface2 and updates Marshal_Interface to return IInterface1. |
| src/tests/Interop/COM/ServerContracts/Server.Contracts.cs | Adjusts managed contract interfaces to align with updated COM interop validation scenarios. |
| src/tests/Interop/COM/NativeServer/MiscTypesTesting.h | Updates native COM server to implement/return IInterface1 for interface marshalling tests. |
| src/tests/Interop/COM/NativeClients/MiscTypes/MiscTypes.cpp | Updates native COM client test to use IInterface1 in interface marshalling validation. |
| src/tests/Interop/COM/NETClients/MiscTypes/Program.cs | Adds/updates managed COM client validation for interface identity/casting behavior. |
| src/coreclr/vm/methodtable.h | Updates HasDynamicInterfaceMap() logic and documents the rationale/usage in COM interop. |
jkoritzinsky
approved these changes
Jan 28, 2026
Member
Author
|
/ba-g Known issue with Windows arm64 machines. |
Member
Author
|
/backport to release/10.0 |
Contributor
|
Started backporting to |
4 tasks
steveisok
pushed a commit
that referenced
this pull request
Feb 2, 2026
…edux) (#123762) Backport of #123725 to release/10.0 /cc @AaronRobinsonMSFT ## Customer Impact - [x] Customer reported - [ ] Found internally In #112375 a fix was checked in with insufficient validation. An issue was reported offline that uncovered a deficiency in that fix and the validation. This PR revisits that issue for .NET 10, adds the missing test cases, and adds comments on the utility of the dynamic interface map. The regression is the casting of built-in COM interop objects to some managed (COM and non-COM) interfaces, depending on how the COM object enters the runtime. Occasionally there are workarounds, but in the most recent offline issue the workaround is very impactful. Re fixes #112371 ## Regression - [x] Yes - [ ] No The PR that originally started this all off was #105965. ## Testing Added and verified tests for the original reported test and the one described offline - all now pass. Both the original OP reported issue and most recent issue were verifiied fixed with this change. ## Risk Low to Medium. The risk here isn't destabilizing issue, but rather introducing or not fixing a regression on some important niche scenario from the original change, #105965. This change is also considered low risk because this change represents a much more targeted change relative to the change that introduced the regression (that is, the additional of a new interface on the `__ComObject` when previously it had none). --------- Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #112375 a fix was checked in with insufficient validation. An issue was reported offline that uncovered a deficiency in that fix and the validation. This PR revisits that issue, adds the needed comprehensive testing, and adds comments on the utility of the dynamic interface map.
Re fixes #112371