Linker.Steps\MarkStep.cs (128)
258if (Annotations.GetEntryPointAssembly() is AssemblyDefinition entryPoint)
295Annotations.SetAction(body.Method, MethodAction.ConvertToThrow);
314if (Annotations.TryGetPreserve(type, out TypePreserve preserve) && preserve == TypePreserve.All)
317switch (Annotations.GetAction(type.Module.Assembly))
417Debug.Assert(Annotations.GetAction(assembly) == action);
432var action = Annotations.GetAction(assembly);
435if (!Annotations.IsProcessed(assembly))
463foreach (var pending in Annotations.GetMarkedPending())
468if (Annotations.IsProcessed(pending.Key))
487Annotations.SetProcessed(exportedType);
495foreach (var type in Annotations.GetPendingPreserve())
510if (Annotations.IsInstantiated(type))
568if (Annotations.IsInstantiated(type) || Annotations.IsRelevantToVariantCasting(type) ||
576var baseMethods = Annotations.GetBaseMethods(method);
595switch (Annotations.GetAction(assembly))
614if (!Annotations.IsMarked(type) && TypeIsDynamicInterfaceCastableImplementation(type))
639if (Annotations.IsMarked(type))
647if (Annotations.IsMarked(iface.InterfaceType))
665if (Annotations.IsInstantiated(body.Method.DeclaringType))
676Annotations.EnqueueVirtualMethod(method);
686var defaultImplementations = Annotations.GetDefaultInterfaceImplementations(method);
697List<OverrideInformation>? overridingMethods = (List<OverrideInformation>?)Annotations.GetOverrides(method);
717Debug.Assert(Annotations.IsMarked(overrideInformation.Base) || IgnoreScope(overrideInformation.Base.DeclaringType.Scope));
718if (!Annotations.IsMarked(overrideInformation.Override.DeclaringType))
729if (Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
747if (Context.IsOptimizationEnabled(CodeOptimizations.OverrideRemoval, overrideInformation.Override) && Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
761Debug.Assert(Annotations.IsMarked(method.DeclaringType));
763var bases = Annotations.GetBaseMethods(method);
767var markedBaseMethods = bases.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope));
811if ((!ov.Override.IsStatic && !Annotations.IsInstantiated(ov.InterfaceImplementor.Implementor))
812|| ov.Override.IsStatic && !Annotations.IsRelevantToVariantCasting(ov.InterfaceImplementor.Implementor))
839bool providerInLinkedAssembly = Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(provider)) == AssemblyAction.Link;
871foreach (var dynamicDependency in Annotations.GetLinkerAttributes<DynamicDependency>(providerMember))
877foreach (var attr in Annotations.GetLinkerAttributes<RemoveAttributeInstancesAttribute>(attributeType))
1179Annotations.Mark(ca, reason);
1221if (type is null || !Annotations.IsMarked(type))
1230if (Annotations.HasPreservedStaticCtor(type))
1242Annotations.SetPreservedStaticCtor(type);
1254if (!Annotations.IsMarked(resolvedConstructor.Module) &&
1255!Annotations.IsMarked(ca.AttributeType) &&
1256Annotations.GetAction(resolvedConstructor.Module.Assembly) == AssemblyAction.Link)
1265if (displayTargetType == null || !Annotations.IsMarked(displayTargetType))
1326if (property != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(property.SetMethod))
1365if (field != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(field))
1411if (resolvedConstructor != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(resolvedConstructor))
1458return !Annotations.SetProcessed(provider);
1463Annotations.Mark(assembly, reason, origin);
1480var action = Annotations.GetAction(assembly);
1491else if (Annotations.IsRootAssembly(assembly))
1508Debug.Assert(Annotations.IsProcessed(assembly));
1586if (Annotations.HasMarkedAnyIndirectlyCalledMethods() && MarkDisablePrivateReflectionAttribute())
1613if (IsAttributeRemoved(customAttribute, resolved.DeclaringType) && Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1715if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1728isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode(method, out requiresUnreferencedCode);
1738isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1747isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1758isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1765bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(method);
1808bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1819bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(member);
1836Debug.Assert(Annotations.IsMarked(field));
1840Annotations.Mark(field, reason, origin);
1878if (field.IsStatic && !Annotations.HasPreservedStaticCtor(parent))
1909if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1912if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1923if (Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(field))
1936return assembly != null && Annotations.GetAction(assembly) != AssemblyAction.Link;
1943Debug.Assert(Annotations.IsMarked(module));
1947Annotations.Mark(module, reason, origin);
1980Annotations.MarkReflectionUsed(definition);
1988Annotations.MarkRelevantToVariantCasting(type);
1996Annotations.MarkReflectionUsed(methodDefinition);
1997Annotations.MarkIndirectlyCalledMethod(methodDefinition);
2008if (IsFullyPreservedAction(Annotations.GetAction(type.Module.Assembly)))
2009Annotations.SetAction(method, MethodAction.ForceParse);
2037if (propertyDefinition != null && !Annotations.IsMarked(propertyDefinition))
2105Debug.Assert(Annotations.IsMarked(type));
2108Annotations.Mark(type, reason, origin);
2116if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(type))
2305if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(resolvedAttributeType) && Annotations.GetAction(type.Module.Assembly) == AssemblyAction.Link)
2551var ifaces = Annotations.GetRecursiveInterfaces(type);
2566if (ifaces.All(Annotations.IsMarked))
2575if (Annotations.IsMarked(resolvedInterfaceType))
2619if (Annotations.IsMarked(method))
2625var base_list = Annotations.GetBaseMethods(method);
2662if (Annotations.IsMarked(method))
2668if (!((iface is not null && Annotations.IsMarked(iface))
2674if (!Annotations.IsMarked(@base) && !IgnoreScope(@base.DeclaringType.Scope))
2685return Annotations.IsRelevantToVariantCasting(overrideInformation.InterfaceImplementor.Implementor)
2690return Annotations.IsInstantiated(overrideInformation.InterfaceImplementor.Implementor);
2917if (parameter is not null && Annotations.FlowAnnotations.RequiresGenericArgumentDataFlowAnalysis(parameter))
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))
3835if (!Annotations.IsProcessed(methodIL.Method))
3842Debug.Assert(Annotations.IsProcessed(owningMethod));
3878&& !Annotations.IsInstantiated(methodIL.Method.DeclaringType)
4004if (!Annotations.IsInstantiated(type))
4029if (Annotations.IsMarked(iface))
4031Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(DependencyKind.InterfaceImplementationOnType, origin.Provider));