Linker.Steps\MarkStep.cs (127)
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);
2018if (IsFullyPreservedAction(Annotations.GetAction(type.Module.Assembly)))
2019Annotations.SetAction(method, MethodAction.ForceParse);
2054if (propertyDefinition != null && !Annotations.IsMarked(propertyDefinition))
2122Debug.Assert(Annotations.IsMarked(type));
2125Annotations.Mark(type, reason, origin);
2133if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(type))
2323if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(resolvedAttributeType) && Annotations.GetAction(type.Module.Assembly) == AssemblyAction.Link)
2569var ifaces = Annotations.GetRecursiveInterfaces(type);
2584if (ifaces.All(Annotations.IsMarked))
2593if (Annotations.IsMarked(resolvedInterfaceType))
2637if (Annotations.IsMarked(method))
2643var base_list = Annotations.GetBaseMethods(method);
2680if (Annotations.IsMarked(method))
2686if (!((iface is not null && Annotations.IsMarked(iface))
2692if (!Annotations.IsMarked(@base) && !IgnoreScope(@base.DeclaringType.Scope))
2703return Annotations.IsRelevantToVariantCasting(overrideInformation.InterfaceImplementor.Implementor)
2708return Annotations.IsInstantiated(overrideInformation.InterfaceImplementor.Implementor);
2959if (Annotations.TryGetPreserve(type, out TypePreserve preserve))
2961if (!Annotations.SetAppliedPreserve(type, preserve))
2984if (Annotations.TryGetPreservedMembers(type, out TypePreserveMembers members))
3057var list = Annotations.GetPreservedMethods(type);
3061Annotations.ClearPreservedMethods(type);
3067var list = Annotations.GetPreservedMethods(method);
3071Annotations.ClearPreservedMethods(method);
3164var methodAction = Annotations.GetAction(method);
3171Annotations.TryGetMethodStubValue(method, out _);
3175Annotations.SetAction(method, MethodAction.Parse);
3186Debug.Assert(Annotations.IsMarked(method));
3189Annotations.Mark(method, reason, origin);
3369else if (method.IsStaticConstructor() && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3371else if (method == method.Module.EntryPoint && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3376if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker(method))
3377Annotations.ProcessSatelliteAssemblies = true;
3398bool markAllOverrides = assembly != null && Annotations.GetAction(assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3426if (Annotations.GetOverrides(method) is IEnumerable<OverrideInformation> overrides)
3428foreach (var @override in overrides.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope)))
3517if (Annotations.IsInstantiated(type))
3520Annotations.MarkInstantiated(type);
3549var ifaces = Annotations.GetRecursiveInterfaces(method.DeclaringType);
3564switch (Annotations.GetAction(method))
3631var base_methods = Annotations.GetBaseMethods(method);
3657Annotations.MarkProcessed(pii.Module, new DependencyInfo(DependencyKind.InteropMethodDependency, method));
3723switch (Annotations.GetAction(method))
3731switch (Annotations.GetAction(assembly))
3749if (!Annotations.MarkProcessed(prop, reason))
3768if (!Annotations.MarkProcessed(evt, reason))
3865if (!Annotations.IsProcessed(methodIL.Method))
3872Debug.Assert(Annotations.IsProcessed(owningMethod));
3908&& !Annotations.IsInstantiated(methodIL.Method.DeclaringType)
4053if (!Annotations.IsInstantiated(type))
4078if (Annotations.IsMarked(iface))
4080Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(DependencyKind.InterfaceImplementationOnType, origin.Provider));