Test case:
[assembly: TypeMap<UsedExternalTypeMap>("BothInExternalAndProxy", typeof(BothInExternalAndProxy), typeof(BothInExternalAndProxy))]
[assembly: TypeMapAssociation<UsedExternalTypeMap>(typeof(BothInExternalAndProxy), typeof(BothInExternalAndProxyTarget))]
class BothInExternalAndProxy;
class BothInExternalAndProxyTarget;
Console.WriteLine(new BothInExternalAndProxy());
results in the TypeMapAssociation attribute being trimmed away.
This happens because when illink sees a TypeMap attribute, it marks the target type as instantiated:
|
_context.Annotations.MarkInstantiated(targetTypeDef); |
which causes MarkRequirementsForInstantiatedTypes to exit early:
|
protected virtual void MarkRequirementsForInstantiatedTypes(TypeDefinition type) |
|
{ |
|
if (Annotations.IsInstantiated(type)) |
|
return; |
and then TypeMapHandler.ProcessInstantiatedType later in the method isn't called:
|
_typeMapHandler.ProcessInstantiated(type); |
so then the TypeMapAssociation attribute is never marked.
Test case:
results in the
TypeMapAssociationattribute being trimmed away.This happens because when illink sees a
TypeMapattribute, it marks the target type as instantiated:runtime/src/tools/illink/src/linker/Linker/TypeMapHandler.cs
Line 111 in cab811a
which causes
MarkRequirementsForInstantiatedTypesto exit early:runtime/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs
Lines 3511 to 3514 in cab811a
and then
TypeMapHandler.ProcessInstantiatedTypelater in the method isn't called:runtime/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs
Line 3532 in cab811a
so then the
TypeMapAssociationattribute is never marked.