@@ -500,6 +500,7 @@ private static void CopyEventsInType(ReferenceImporter importer, TypeAnalysisCon
500500 public static void AddExplicitInterfaceImplementations ( AssemblyAnalysisContext asmContext )
501501 {
502502 var managedAssembly = asmContext . GetExtraData < AssemblyDefinition > ( "AsmResolverAssembly" ) ?? throw new ( "AsmResolver assembly not found in assembly analysis context for " + asmContext ) ;
503+ var runtimeContext = asmContext . AppContext . GetExtraData < RuntimeContext > ( "AsmResolverRuntimeContext" ) ?? throw new ( "AsmResolver runtime context not found in application analysis context" ) ;
503504
504505 var importer = managedAssembly . ManifestModule ! . DefaultImporter ;
505506
@@ -514,7 +515,7 @@ public static void AddExplicitInterfaceImplementations(AssemblyAnalysisContext a
514515 try
515516#endif
516517 {
517- AddExplicitInterfaceImplementations ( managedType , typeContext , importer ) ;
518+ AddExplicitInterfaceImplementations ( managedType , typeContext , importer , runtimeContext ) ;
518519 }
519520#if ! DEBUG
520521 catch ( Exception e )
@@ -525,7 +526,7 @@ public static void AddExplicitInterfaceImplementations(AssemblyAnalysisContext a
525526 }
526527 }
527528
528- private static void AddExplicitInterfaceImplementations ( TypeDefinition type , TypeAnalysisContext typeContext , ReferenceImporter importer )
529+ private static void AddExplicitInterfaceImplementations ( TypeDefinition type , TypeAnalysisContext typeContext , ReferenceImporter importer , RuntimeContext runtimeContext )
529530 {
530531 List < ( PropertyDefinition InterfaceProperty , TypeSignature InterfaceType , MethodDefinition Method ) > ? getMethodsToCreate = null ;
531532 List < ( PropertyDefinition InterfaceProperty , TypeSignature InterfaceType , MethodDefinition Method ) > ? setMethodsToCreate = null ;
@@ -540,20 +541,20 @@ private static void AddExplicitInterfaceImplementations(TypeDefinition type, Typ
540541 var interfaceMethod = ( IMethodDefOrRef ) overrideContext . ToMethodDescriptor ( importer . TargetModule ) ;
541542 var method = methodContext . GetExtraData < MethodDefinition > ( "AsmResolverMethod" ) ?? throw new ( $ "AsmResolver method not found in method analysis context for { methodContext } ") ;
542543 type . MethodImplementations . Add ( new MethodImplementation ( interfaceMethod , method ) ) ;
543- var interfaceMethodResolved = interfaceMethod . Resolve ( ) ;
544- if ( interfaceMethodResolved != null )
544+ var resolutionStatus = interfaceMethod . Resolve ( runtimeContext , out var interfaceMethodResolved ) ;
545+ if ( resolutionStatus is ResolutionStatus . Success && interfaceMethodResolved != null )
545546 {
546547 if ( interfaceMethodResolved . IsGetMethod && ! method . IsGetMethod )
547548 {
548549 getMethodsToCreate ??= [ ] ;
549550 var interfacePropertyResolved = interfaceMethodResolved . DeclaringType ! . Properties . First ( p => p . Semantics . Contains ( interfaceMethodResolved . Semantics ) ) ;
550- getMethodsToCreate . Add ( ( interfacePropertyResolved , interfaceMethod . DeclaringType ! . ToTypeSignature ( ) , method ) ) ;
551+ getMethodsToCreate . Add ( ( interfacePropertyResolved , interfaceMethod . DeclaringType ! . ToTypeSignature ( runtimeContext ) , method ) ) ;
551552 }
552553 else if ( interfaceMethodResolved . IsSetMethod && ! method . IsSetMethod )
553554 {
554555 setMethodsToCreate ??= [ ] ;
555556 var interfacePropertyResolved = interfaceMethodResolved . DeclaringType ! . Properties . First ( p => p . Semantics . Contains ( interfaceMethodResolved . Semantics ) ) ;
556- setMethodsToCreate . Add ( ( interfacePropertyResolved , interfaceMethod . DeclaringType ! . ToTypeSignature ( ) , method ) ) ;
557+ setMethodsToCreate . Add ( ( interfacePropertyResolved , interfaceMethod . DeclaringType ! . ToTypeSignature ( runtimeContext ) , method ) ) ;
557558 }
558559 }
559560 }
@@ -566,7 +567,7 @@ private static void AddExplicitInterfaceImplementations(TypeDefinition type, Typ
566567 {
567568 var ( interfaceProperty , interfaceType , getMethod ) = entry ;
568569 var setMethod = setMethodsToCreate ?
569- . FirstOrDefault ( e => e . InterfaceProperty == interfaceProperty && SignatureComparer . Default . Equals ( e . InterfaceType , interfaceType ) )
570+ . FirstOrDefault ( e => e . InterfaceProperty == interfaceProperty && runtimeContext . SignatureComparer . Equals ( e . InterfaceType , interfaceType ) )
570571 . Method ;
571572
572573 var name = $ "{ interfaceType . FullName } .{ interfaceProperty . Name } ";
@@ -583,7 +584,7 @@ private static void AddExplicitInterfaceImplementations(TypeDefinition type, Typ
583584 foreach ( var entry in setMethodsToCreate )
584585 {
585586 var ( interfaceProperty , interfaceType , setMethod ) = entry ;
586- if ( getMethodsToCreate ? . Any ( e => e . InterfaceProperty == interfaceProperty && SignatureComparer . Default . Equals ( e . InterfaceType , interfaceType ) ) == true )
587+ if ( getMethodsToCreate ? . Any ( e => e . InterfaceProperty == interfaceProperty && runtimeContext . SignatureComparer . Equals ( e . InterfaceType , interfaceType ) ) == true )
587588 continue ;
588589 var name = $ "{ interfaceType . FullName } .{ interfaceProperty . Name } ";
589590 var propertySignature = setMethod . IsStatic
0 commit comments