From 47607df2546f97caebf8da8e945dc4a423e134cf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 05:28:42 +0000 Subject: [PATCH 1/5] Initial plan From b24b4bb1b43f348e72fec5e858168ee2a936e79f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 05:33:14 +0000 Subject: [PATCH 2/5] Remove unused fNullOk parameter from GetMethodDescForComInterfaceMethod Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com> --- src/coreclr/vm/methodtable.cpp | 7 +++---- src/coreclr/vm/methodtable.h | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index 9d42363f8815ab..57bbf485581840 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -505,7 +505,7 @@ PTR_MethodTable InterfaceInfo_t::GetApproxMethodTable(Module * pContainingModule FALSE, // allowInstParam TRUE); // forceRemotableMethod - RETURN(pServerMT->GetMethodDescForComInterfaceMethod(pItfMD, false)); + RETURN(pServerMT->GetMethodDescForComInterfaceMethod(pItfMD)); } #endif // !FEATURE_COMINTEROP @@ -536,8 +536,7 @@ PTR_MethodTable InterfaceInfo_t::GetApproxMethodTable(Module * pContainingModule #ifdef FEATURE_COMINTEROP //========================================================================================== // get the method desc given the interface method desc on a COM implemented server -// (if fNullOk is set then NULL is an allowable return value) -MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD, bool fNullOk) +MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD) { CONTRACT(MethodDesc*) { @@ -547,7 +546,7 @@ MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD, PRECONDITION(CheckPointer(pItfMD)); PRECONDITION(pItfMD->IsInterface()); PRECONDITION(IsComObjectType()); - POSTCONDITION(fNullOk || CheckPointer(RETVAL)); + POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END; diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h index f8ca9962d209eb..39d8c1d2f0998f 100644 --- a/src/coreclr/vm/methodtable.h +++ b/src/coreclr/vm/methodtable.h @@ -2462,8 +2462,8 @@ class MethodTable static MethodDesc *GetMethodDescForInterfaceMethodAndServer(TypeHandle ownerType, MethodDesc *pItfMD, OBJECTREF *pServer); #ifdef FEATURE_COMINTEROP - // get the method desc given the interface method desc on a COM implemented server (if fNullOk is set then NULL is an allowable return value) - MethodDesc *GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD, bool fNullOk); + // get the method desc given the interface method desc on a COM implemented server + MethodDesc *GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD); #endif // FEATURE_COMINTEROP // Resolve virtual static interface method pInterfaceMD on this type. From fdbf346fcc3c49308d277c9a2dc91ae9e016f8e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 05:53:23 +0000 Subject: [PATCH 3/5] Fix POSTCONDITION to allow NULL return value Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com> --- src/coreclr/vm/methodtable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index 57bbf485581840..3a9ec863a9c412 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -546,7 +546,7 @@ MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD) PRECONDITION(CheckPointer(pItfMD)); PRECONDITION(pItfMD->IsInterface()); PRECONDITION(IsComObjectType()); - POSTCONDITION(CheckPointer(RETVAL)); + POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; From 8738fe730de8b5d8ad5dc0f5ac44999f1aac2f1c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 07:00:32 +0000 Subject: [PATCH 4/5] Fix POSTCONDITION and remove NULL return path Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com> --- src/coreclr/vm/methodtable.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index 3a9ec863a9c412..c7b0f613f66b29 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -546,7 +546,7 @@ MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD) PRECONDITION(CheckPointer(pItfMD)); PRECONDITION(pItfMD->IsInterface()); PRECONDITION(IsComObjectType()); - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); + POSTCONDITION(CheckPointer(RETVAL)); } CONTRACT_END; @@ -576,17 +576,12 @@ MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD) // The interface is not in the static class definition so we need to look at the // dynamic interfaces. - else if (FindDynamicallyAddedInterface(pItfMT)) - { - // This interface was added to the class dynamically so it is implemented - // by the COM object. We treat this dynamically added interfaces the same - // way we treat COM objects. That is by using the interface vtable. - RETURN(pItfMD); - } - else - { - RETURN(NULL); - } + _ASSERTE(FindDynamicallyAddedInterface(pItfMT)); + + // This interface was added to the class dynamically so it is implemented + // by the COM object. We treat this dynamically added interfaces the same + // way we treat COM objects. That is by using the interface vtable. + RETURN(pItfMD); } } #endif // FEATURE_COMINTEROP From 503cb7bbabbabd70a914131bedb9dbd6df8de3b4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 07:02:19 +0000 Subject: [PATCH 5/5] Fix grammatical error in comment Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com> --- src/coreclr/vm/methodtable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index c7b0f613f66b29..470d35b23cbbfc 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -579,7 +579,7 @@ MethodDesc *MethodTable::GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD) _ASSERTE(FindDynamicallyAddedInterface(pItfMT)); // This interface was added to the class dynamically so it is implemented - // by the COM object. We treat this dynamically added interfaces the same + // by the COM object. We treat this dynamically added interface the same // way we treat COM objects. That is by using the interface vtable. RETURN(pItfMD); }