Linker.Steps\MarkStep.cs (127)
257_typeMapHandler.Initialize(Context, this, Annotations.GetEntryPointAssembly());
288Annotations.SetAction(body.Method, MethodAction.ConvertToThrow);
307if (Annotations.TryGetPreserve(type, out TypePreserve preserve) && preserve == TypePreserve.All)
310switch (Annotations.GetAction(type.Module.Assembly))
410Debug.Assert(Annotations.GetAction(assembly) == action);
425var action = Annotations.GetAction(assembly);
428if (!Annotations.IsProcessed(assembly))
456foreach (var pending in Annotations.GetMarkedPending())
461if (Annotations.IsProcessed(pending.Key))
480Annotations.SetProcessed(exportedType);
488foreach (var type in Annotations.GetPendingPreserve())
503if (Annotations.IsInstantiated(type))
561if (Annotations.IsInstantiated(type) || Annotations.IsRelevantToVariantCasting(type) ||
569var baseMethods = Annotations.GetBaseMethods(method);
588switch (Annotations.GetAction(assembly))
607if (!Annotations.IsMarked(type) && TypeIsDynamicInterfaceCastableImplementation(type))
632if (Annotations.IsMarked(type))
640if (Annotations.IsMarked(iface.InterfaceType))
658if (Annotations.IsInstantiated(body.Method.DeclaringType))
669Annotations.EnqueueVirtualMethod(method);
679var defaultImplementations = Annotations.GetDefaultInterfaceImplementations(method);
690List<OverrideInformation>? overridingMethods = (List<OverrideInformation>?)Annotations.GetOverrides(method);
710Debug.Assert(Annotations.IsMarked(overrideInformation.Base) || IgnoreScope(overrideInformation.Base.DeclaringType.Scope));
711if (!Annotations.IsMarked(overrideInformation.Override.DeclaringType))
722if (Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
740if (Context.IsOptimizationEnabled(CodeOptimizations.OverrideRemoval, overrideInformation.Override) && Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
754Debug.Assert(Annotations.IsMarked(method.DeclaringType));
756var bases = Annotations.GetBaseMethods(method);
760var markedBaseMethods = bases.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope));
804if ((!ov.Override.IsStatic && !Annotations.IsInstantiated(ov.InterfaceImplementor.Implementor))
805|| ov.Override.IsStatic && !Annotations.IsRelevantToVariantCasting(ov.InterfaceImplementor.Implementor))
832bool providerInLinkedAssembly = Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(provider)) == AssemblyAction.Link;
864foreach (var dynamicDependency in Annotations.GetLinkerAttributes<DynamicDependency>(providerMember))
870foreach (var attr in Annotations.GetLinkerAttributes<RemoveAttributeInstancesAttribute>(attributeType))
1172Annotations.Mark(ca, reason);
1214if (type is null || !Annotations.IsMarked(type))
1223if (Annotations.HasPreservedStaticCtor(type))
1235Annotations.SetPreservedStaticCtor(type);
1247if (!Annotations.IsMarked(resolvedConstructor.Module) &&
1248!Annotations.IsMarked(ca.AttributeType) &&
1249Annotations.GetAction(resolvedConstructor.Module.Assembly) == AssemblyAction.Link)
1258if (displayTargetType == null || !Annotations.IsMarked(displayTargetType))
1319if (property != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(property.SetMethod))
1358if (field != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(field))
1404if (resolvedConstructor != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(resolvedConstructor))
1451return !Annotations.SetProcessed(provider);
1456Annotations.Mark(assembly, reason, origin);
1473var action = Annotations.GetAction(assembly);
1484else if (Annotations.IsRootAssembly(assembly))
1501Debug.Assert(Annotations.IsProcessed(assembly));
1579if (Annotations.HasMarkedAnyIndirectlyCalledMethods() && MarkDisablePrivateReflectionAttribute())
1606if (IsAttributeRemoved(customAttribute, resolved.DeclaringType) && Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1708if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1721isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode(method, out requiresUnreferencedCode);
1731isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1740isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1751isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1758bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(method);
1801bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1812bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(member);
1829Debug.Assert(Annotations.IsMarked(field));
1833Annotations.Mark(field, reason, origin);
1871if (field.IsStatic && !Annotations.HasPreservedStaticCtor(parent))
1902if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1905if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1916if (Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(field))
1929return assembly != null && Annotations.GetAction(assembly) != AssemblyAction.Link;
1936Debug.Assert(Annotations.IsMarked(module));
1940Annotations.Mark(module, reason, origin);
1973Annotations.MarkReflectionUsed(definition);
1981Annotations.MarkRelevantToVariantCasting(type);
1989Annotations.MarkReflectionUsed(methodDefinition);
1990Annotations.MarkIndirectlyCalledMethod(methodDefinition);
2011if (IsFullyPreservedAction(Annotations.GetAction(type.Module.Assembly)))
2012Annotations.SetAction(method, MethodAction.ForceParse);
2047if (propertyDefinition != null && !Annotations.IsMarked(propertyDefinition))
2115Debug.Assert(Annotations.IsMarked(type));
2118Annotations.Mark(type, reason, origin);
2126if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(type))
2316if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(resolvedAttributeType) && Annotations.GetAction(type.Module.Assembly) == AssemblyAction.Link)
2562var ifaces = Annotations.GetRecursiveInterfaces(type);
2577if (ifaces.All(Annotations.IsMarked))
2586if (Annotations.IsMarked(resolvedInterfaceType))
2630if (Annotations.IsMarked(method))
2636var base_list = Annotations.GetBaseMethods(method);
2673if (Annotations.IsMarked(method))
2679if (!((iface is not null && Annotations.IsMarked(iface))
2685if (!Annotations.IsMarked(@base) && !IgnoreScope(@base.DeclaringType.Scope))
2696return Annotations.IsRelevantToVariantCasting(overrideInformation.InterfaceImplementor.Implementor)
2701return Annotations.IsInstantiated(overrideInformation.InterfaceImplementor.Implementor);
2952if (Annotations.TryGetPreserve(type, out TypePreserve preserve))
2954if (!Annotations.SetAppliedPreserve(type, preserve))
2977if (Annotations.TryGetPreservedMembers(type, out TypePreserveMembers members))
3050var list = Annotations.GetPreservedMethods(type);
3054Annotations.ClearPreservedMethods(type);
3060var list = Annotations.GetPreservedMethods(method);
3064Annotations.ClearPreservedMethods(method);
3157var methodAction = Annotations.GetAction(method);
3164Annotations.TryGetMethodStubValue(method, out _);
3168Annotations.SetAction(method, MethodAction.Parse);
3179Debug.Assert(Annotations.IsMarked(method));
3182Annotations.Mark(method, reason, origin);
3362else if (method.IsStaticConstructor() && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3364else if (method == method.Module.EntryPoint && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3369if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker(method))
3370Annotations.ProcessSatelliteAssemblies = true;
3391bool markAllOverrides = assembly != null && Annotations.GetAction(assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3419if (Annotations.GetOverrides(method) is IEnumerable<OverrideInformation> overrides)
3421foreach (var @override in overrides.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope)))
3510if (Annotations.IsInstantiated(type))
3513Annotations.MarkInstantiated(type);
3542var ifaces = Annotations.GetRecursiveInterfaces(method.DeclaringType);
3557switch (Annotations.GetAction(method))
3624var base_methods = Annotations.GetBaseMethods(method);
3650Annotations.MarkProcessed(pii.Module, new DependencyInfo(DependencyKind.InteropMethodDependency, method));
3716switch (Annotations.GetAction(method))
3724switch (Annotations.GetAction(assembly))
3742if (!Annotations.MarkProcessed(prop, reason))
3761if (!Annotations.MarkProcessed(evt, reason))
3858if (!Annotations.IsProcessed(methodIL.Method))
3865Debug.Assert(Annotations.IsProcessed(owningMethod));
3901&& !Annotations.IsInstantiated(methodIL.Method.DeclaringType)
4046if (!Annotations.IsInstantiated(type))
4071if (Annotations.IsMarked(iface))
4073Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(DependencyKind.InterfaceImplementationOnType, origin.Provider));