@@ -610,7 +610,7 @@ public override MethodDesc ResolveVariantInterfaceMethodToStaticVirtualMethodOnT
610610 // function returns null if the interface method implementation is not defined by the current type in
611611 // the hierarchy.For variance to work correctly, this requires that interfaces be queried in correct order.
612612 // See current interface call resolution for details on how that happens.
613- private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnType ( MethodDesc interfaceMethod , MetadataType currentType )
613+ private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnType ( MethodDesc interfaceMethod , MetadataType currentType , bool returnRecursive = false )
614614 {
615615 Debug . Assert ( ! interfaceMethod . Signature . IsStatic ) ;
616616
@@ -665,7 +665,7 @@ private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnType(MethodDesc
665665 MethodDesc baseClassImplementationOfInterfaceMethod = ResolveInterfaceMethodToVirtualMethodOnTypeRecursive ( interfaceMethod , baseType ) ;
666666 if ( baseClassImplementationOfInterfaceMethod != null )
667667 {
668- return null ;
668+ return returnRecursive ? baseClassImplementationOfInterfaceMethod : null ;
669669 }
670670 else
671671 {
@@ -716,6 +716,7 @@ public static MethodDesc ResolveVariantInterfaceMethodToVirtualMethodOnType(Meth
716716 // Helper routine used during implicit interface implementation discovery
717717 private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnTypeRecursive ( MethodDesc interfaceMethod , MetadataType currentType )
718718 {
719+ MethodDesc savedResult = null ;
719720 while ( true )
720721 {
721722 if ( currentType == null )
@@ -729,7 +730,7 @@ private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnTypeRecursive(M
729730 return null ;
730731 }
731732
732- MethodDesc currentTypeInterfaceResolution = ResolveInterfaceMethodToVirtualMethodOnType ( interfaceMethod , currentType ) ;
733+ MethodDesc currentTypeInterfaceResolution = ResolveInterfaceMethodToVirtualMethodOnType ( interfaceMethod , currentType , returnRecursive : true ) ;
733734 if ( currentTypeInterfaceResolution != null )
734735 return currentTypeInterfaceResolution ;
735736
0 commit comments