@@ -898,11 +898,6 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
898898
899899 yield return new DependencyListEntry ( context . GenericDictionaryLayout ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) . GetClosestDefType ( ) ) , "Dictionary layout" ) ;
900900
901- foreach ( TypeDesc iface in _type . RuntimeInterfaces )
902- {
903- yield return new DependencyListEntry ( context . NativeLayout . TypeSignatureVertex ( iface ) , "template interface list" ) ;
904- }
905-
906901 if ( context . PreinitializationManager . HasLazyStaticConstructor ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) ) )
907902 {
908903 yield return new DependencyListEntry ( context . MethodEntrypoint ( _type . GetStaticConstructor ( ) . GetCanonMethodTarget ( CanonicalFormKind . Specific ) ) , "cctor for template" ) ;
@@ -944,8 +939,14 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
944939 }
945940 }
946941
947- public override bool HasConditionalStaticDependencies => false ;
948- public override IEnumerable < CombinedDependencyListEntry > GetConditionalStaticDependencies ( NodeFactory context ) => null ;
942+ public override bool HasConditionalStaticDependencies => _type . RuntimeInterfaces . Length > 0 ;
943+ public override IEnumerable < CombinedDependencyListEntry > GetConditionalStaticDependencies ( NodeFactory factory )
944+ {
945+ foreach ( TypeDesc iface in _type . RuntimeInterfaces )
946+ {
947+ yield return new CombinedDependencyListEntry ( factory . NativeLayout . TypeSignatureVertex ( iface ) , factory . InterfaceUse ( iface . GetTypeDefinition ( ) ) , "template interface list" ) ;
948+ }
949+ }
949950
950951 private static int CompareDictionaryEntries ( KeyValuePair < int , NativeLayoutVertexNode > left , KeyValuePair < int , NativeLayoutVertexNode > right )
951952 {
@@ -968,11 +969,16 @@ public override Vertex WriteVertex(NodeFactory factory)
968969
969970 foreach ( TypeDesc iface in _type . RuntimeInterfaces )
970971 {
971- implementedInterfacesList . Add ( factory . NativeLayout . TypeSignatureVertex ( iface ) ) ;
972+ if ( factory . InterfaceUse ( iface . GetTypeDefinition ( ) ) . Marked )
973+ implementedInterfacesList . Add ( factory . NativeLayout . TypeSignatureVertex ( iface ) ) ;
972974 }
973- NativeLayoutPlacedVertexSequenceVertexNode implementedInterfaces = factory . NativeLayout . PlacedVertexSequence ( implementedInterfacesList ) ;
974975
975- layoutInfo . Append ( BagElementKind . ImplementedInterfaces , implementedInterfaces . WriteVertex ( factory ) ) ;
976+ if ( implementedInterfacesList . Count > 0 )
977+ {
978+ NativeLayoutPlacedVertexSequenceVertexNode implementedInterfaces = factory . NativeLayout . PlacedVertexSequence ( implementedInterfacesList ) ;
979+
980+ layoutInfo . Append ( BagElementKind . ImplementedInterfaces , implementedInterfaces . WriteVertex ( factory ) ) ;
981+ }
976982 }
977983
978984 if ( ! factory . LazyGenericsPolicy . UsesLazyGenerics ( _type ) && templateLayout . Count > 0 )
0 commit comments