-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Look up the correct MethodTable on COM methods.
#121431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look up the correct MethodTable on COM methods.
#121431
Conversation
|
Tagging subscribers to this area: @dotnet/interop-contrib |
a791edf to
01c1e2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors COM interop code in two key ways: simplifying COM object instantiation in tests and improving the implementation of exception handling for COM HRESULTs.
- Removes redundant explicit casts when instantiating COM objects via the CoClass pattern
- Adds diagnostic logging to test execution with
Console.WriteLine(nameof(...)) - Refactors
GetCOMHRExceptionObjectto use a new direct native helper method instead of theRuntimeMethodHandle.FromIntPtrpathway
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/Interop/COM/NETClients/Primitives/StringTests.cs | Removed redundant cast in COM object instantiation and added diagnostic logging |
| src/tests/Interop/COM/NETClients/Primitives/NumericTests.cs | Removed redundant cast in COM object instantiation and added diagnostic logging |
| src/tests/Interop/COM/NETClients/Primitives/ErrorTests.cs | Removed redundant cast in COM object instantiation and added diagnostic logging |
| src/tests/Interop/COM/NETClients/Primitives/ColorTests.cs | Removed redundant cast in COM object instantiation and added diagnostic logging |
| src/tests/Interop/COM/NETClients/Primitives/CallViaReflectionTests.cs | Removed redundant cast in COM object instantiation |
| src/tests/Interop/COM/NETClients/Primitives/ArrayTests.cs | Removed redundant cast in COM object instantiation and added diagnostic logging |
| src/tests/Interop/COM/NETClients/MiscTypes/Program.cs | Removed redundant casts in COM object instantiation |
| src/tests/Interop/COM/NETClients/Licensing/Program.cs | Removed redundant casts in COM object instantiation |
| src/tests/Interop/COM/NETClients/IInspectable/Program.cs | Removed redundant cast in COM object instantiation |
| src/tests/Interop/COM/NETClients/IDispatch/Program.cs | Removed redundant casts in COM object instantiation |
| src/tests/Interop/COM/NETClients/Events/Program.cs | Removed redundant casts in COM object instantiation |
| src/tests/Interop/COM/NETClients/ComDisabled/Program.cs | Removed redundant cast in COM object instantiation |
| src/coreclr/vm/stubhelpers.h | Added declaration for new helper method GetComInterfaceFromMethodDesc |
| src/coreclr/vm/stubhelpers.cpp | Implemented new helper method to extract interface MethodTable from a method descriptor |
| src/coreclr/vm/ecalllist.h | Registered the new helper method as an FCFunc |
| src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs | Refactored GetCOMHRExceptionObject to use new direct native helper instead of RuntimeMethodHandle pathway |
|
/ba-g Unrelated timeouts |
|
/backport to release/10.0 |
|
Started backporting to |
…1512) Backport of #121431 to release/10.0 /cc @AaronRobinsonMSFT ## Customer Impact - [x] Customer reported - [ ] Found internally How a COM server is activated can obscure how we determine the `IID` of a COM interface method. This matters in scenarios involving `ISupportErrorInfo`. A user reported this in #121252. ## Regression - [x] Yes - [ ] No This is a regression from .NET 9. It was introduced in #117690. ## Testing Tests were updated to validate this behavior. ## Risk Low. This only impacts COM scenarios involving `ISupportErrorInfo`. --------- Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
Fixes #121252
Update tests to activate correctly.