Convert more COM interop MethodDescCallSite to UCO#125508
Convert more COM interop MethodDescCallSite to UCO#125508am11 wants to merge 26 commits intodotnet:mainfrom
Conversation
|
This was close to being merged, except the InvokeArgSlot one that needs more work so that we are confident about it. Would you like to resubmit the delta without InvokeArgSlot? |
|
Failures are known/unrelated. |
Co-authored-by: Jan Kotas <[email protected]>
| INT_PTR queriedInterface = reinterpret_cast<INT_PTR>(*ppUnkOut); | ||
| INT32 result = static_cast<INT32>(CustomQueryInterfaceResult::NotHandled); | ||
| UnmanagedCallersOnlyCaller callICustomQueryInterface(METHOD__STUBHELPERS__CALL_ICUSTOM_QUERY_INTERFACE); | ||
| callICustomQueryInterface.InvokeThrowing(&pObj, &guid, &queriedInterface, &result); |
There was a problem hiding this comment.
There is also InvokeThrowing_Ret that can be used to return primitives. We use it in a few places and in this case probably is easier to read. You can then also update the managed signature to be more "natural".
| DEFINE_METHOD(STUBHELPERS, GET_IENUMERATOR_TO_ENUM_VARIANT_MARSHALER, GetIEnumeratorToEnumVariantMarshaler, SM_PtrObj_PtrException_RetVoid) | ||
| DEFINE_METHOD(STUBHELPERS, GET_DISPATCH_EX_PROPERTY_FLAGS, GetDispatchExPropertyFlags, SM_PtrPropertyInfo_PtrInt_PtrException_RetVoid) | ||
| DEFINE_METHOD(STUBHELPERS, CALL_ICUSTOM_QUERY_INTERFACE, CallICustomQueryInterface, SM_PtrICustomQueryInterface_PtrGuid_PtrIntPtr_PtrInt_PtrException_RetVoid) | ||
| DEFINE_METHOD(STUBHELPERS, INVOKE_CONNECTION_POINT_PROVIDER_METHOD, InvokeConnectionPointProviderMethod, SM_PtrObj_IntPtr_PtrObj_IntPtr_PtrObj_IntPtr_Bool_PtrException_RetVoid) |
There was a problem hiding this comment.
| DEFINE_METHOD(STUBHELPERS, INVOKE_CONNECTION_POINT_PROVIDER_METHOD, InvokeConnectionPointProviderMethod, SM_PtrObj_IntPtr_PtrObj_IntPtr_PtrObj_IntPtr_Bool_PtrException_RetVoid) | |
| DEFINE_METHOD(STUBHELPERS, INVOKE_CONNECTION_POINT_PROVIDER_METHOD, InvokeConnectionPointProviderMethod, NoSig) |
This should be nosig now that it has unmanaged pointers in the signatures (encoding the unmanaged pointers in the signature here is not worth the pain).
| INT_PTR queriedInterface = reinterpret_cast<INT_PTR>(*ppUnkOut); | ||
| INT32 result = static_cast<INT32>(CustomQueryInterfaceResult::NotHandled); | ||
| UnmanagedCallersOnlyCaller callICustomQueryInterface(METHOD__STUBHELPERS__CALL_ICUSTOM_QUERY_INTERFACE); | ||
| callICustomQueryInterface.InvokeThrowing(&pObj, &guid, &queriedInterface, &result); | ||
|
|
||
| *ppUnkOut = reinterpret_cast<IUnknown*>(queriedInterface); |
There was a problem hiding this comment.
| INT_PTR queriedInterface = reinterpret_cast<INT_PTR>(*ppUnkOut); | |
| INT32 result = static_cast<INT32>(CustomQueryInterfaceResult::NotHandled); | |
| UnmanagedCallersOnlyCaller callICustomQueryInterface(METHOD__STUBHELPERS__CALL_ICUSTOM_QUERY_INTERFACE); | |
| callICustomQueryInterface.InvokeThrowing(&pObj, &guid, &queriedInterface, &result); | |
| *ppUnkOut = reinterpret_cast<IUnknown*>(queriedInterface); | |
| INT32 result = static_cast<INT32>(CustomQueryInterfaceResult::NotHandled); | |
| UnmanagedCallersOnlyCaller callICustomQueryInterface(METHOD__STUBHELPERS__CALL_ICUSTOM_QUERY_INTERFACE); | |
| callICustomQueryInterface.InvokeThrowing(&pObj, &guid, ppUnkOut, &result); | |
We do not need a local copy of the IUnknown. This should also reduce changes that the IUknown reference leak if an exception is thrown in a specific spot.
|
PR was already approved and we had a good checkpoint with all tests passing. Now I have to go back to debug the new issues in additional changes made in last two hours. I will park this for now from my side. If someone else has time, feel free to continue ( |
|
Asked copilot to continue: #125849 |
Contributes to #123864 (group 5: except dispatchinfo.cpp)