-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Description
Pull request 117690 introduces a change where COM objects that implement ISupportErrorInfo have InterfaceSupportsErrorInfo called with the COM object class id instead of an interface id.
Specifically, the logic at https://github.com/dotnet/runtime/pull/117690/files#diff-c10abbd9bedf89c7a6ea5ace199b19ac17564e0e1e8583cd22b05546d18e0789L591-L609. The look up there first "unwraps" the calling method and then uses the associated type with that method (that is, the interface type).
The missing logic in the above is the call to CLRToComCallInfo::FromMethodDesc -
runtime/src/coreclr/vm/method.inl
Lines 166 to 179 in b22d55a
| // static | |
| inline CLRToCOMCallInfo *CLRToCOMCallInfo::FromMethodDesc(MethodDesc *pMD) | |
| { | |
| LIMITED_METHOD_CONTRACT; | |
| if (pMD->IsCLRToCOMCall()) | |
| { | |
| return ((CLRToCOMCallMethodDesc *)pMD)->m_pCLRToCOMCallInfo; | |
| } | |
| else | |
| { | |
| _ASSERTE(pMD->IsEEImpl()); | |
| return ((DelegateEEClass *)pMD->GetClass())->m_pCLRToCOMCallInfo; | |
| } | |
| } |
MethodDesc properly - runtime/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
Lines 1362 to 1363 in b22d55a
| RuntimeMethodHandle handle = RuntimeMethodHandle.FromIntPtr(pCPCMD); | |
| RuntimeType declaringType = RuntimeMethodHandle.GetDeclaringType(handle.GetMethodInfo()); |
Reproduction Steps
- In a non-.NET language, write a COM object that implements the
ISupportErrorInfointerface. Include a method call that will fail with a known error message. WithinInterfaceSupportsErrorInfodebug print theriidprovided. - Within a C# application, instantiate the COM object and call the method that is known to fail.
- Observe that the known error message is lost.
- Observe that the debug print statement indicates that
InterfaceSupportsErrorInfowas called with the class id instead of an interface id.
Expected behavior
InterfaceSupportsErrorInfo is called with an interface id.
Actual behavior
InterfaceSupportsErrorInfo is called with a class id.
Regression?
Known to work in .NET SDK 9.0.306
Known to not work in .NET SDK 10.0.100-rc.2.25502.107
Known Workarounds
None
Configuration
.NET SDK 10.0.100-rc.2.25502.107
Microsoft Windows 10 Enterprise LTSC 10.0.17763 Build 17763 (but also known to be an issue on Windows 11)
Architecture: Windows x64, application x86
It is not believed that the problem is specific to this configuration.
Other information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status