Linker.Steps\MarkStep.cs (127)
266startingAssembly ??= Annotations.GetEntryPointAssembly();
299Annotations.SetAction(body.Method, MethodAction.ConvertToThrow);
318if (Annotations.TryGetPreserve(type, out TypePreserve preserve) && preserve == TypePreserve.All)
321switch (Annotations.GetAction(type.Module.Assembly))
421Debug.Assert(Annotations.GetAction(assembly) == action);
436var action = Annotations.GetAction(assembly);
439if (!Annotations.IsProcessed(assembly))
467foreach (var pending in Annotations.GetMarkedPending())
472if (Annotations.IsProcessed(pending.Key))
491Annotations.SetProcessed(exportedType);
499foreach (var type in Annotations.GetPendingPreserve())
514if (Annotations.IsInstantiated(type))
572if (Annotations.IsInstantiated(type) || Annotations.IsRelevantToVariantCasting(type) ||
580var baseMethods = Annotations.GetBaseMethods(method);
599switch (Annotations.GetAction(assembly))
618if (!Annotations.IsMarked(type) && TypeIsDynamicInterfaceCastableImplementation(type))
643if (Annotations.IsMarked(type))
651if (Annotations.IsMarked(iface.InterfaceType))
669if (Annotations.IsInstantiated(body.Method.DeclaringType))
680Annotations.EnqueueVirtualMethod(method);
690var defaultImplementations = Annotations.GetDefaultInterfaceImplementations(method);
701List<OverrideInformation>? overridingMethods = (List<OverrideInformation>?)Annotations.GetOverrides(method);
721Debug.Assert(Annotations.IsMarked(overrideInformation.Base) || IgnoreScope(overrideInformation.Base.DeclaringType.Scope));
722if (!Annotations.IsMarked(overrideInformation.Override.DeclaringType))
733if (Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
751if (Context.IsOptimizationEnabled(CodeOptimizations.OverrideRemoval, overrideInformation.Override) && Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
765Debug.Assert(Annotations.IsMarked(method.DeclaringType));
767var bases = Annotations.GetBaseMethods(method);
771var markedBaseMethods = bases.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope));
815if ((!ov.Override.IsStatic && !Annotations.IsInstantiated(ov.InterfaceImplementor.Implementor))
816|| ov.Override.IsStatic && !Annotations.IsRelevantToVariantCasting(ov.InterfaceImplementor.Implementor))
843bool providerInLinkedAssembly = Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(provider)) == AssemblyAction.Link;
875foreach (var dynamicDependency in Annotations.GetLinkerAttributes<DynamicDependency>(providerMember))
881foreach (var attr in Annotations.GetLinkerAttributes<RemoveAttributeInstancesAttribute>(attributeType))
1183Annotations.Mark(ca, reason);
1225if (type is null || !Annotations.IsMarked(type))
1234if (Annotations.HasPreservedStaticCtor(type))
1246Annotations.SetPreservedStaticCtor(type);
1258if (!Annotations.IsMarked(resolvedConstructor.Module) &&
1259!Annotations.IsMarked(ca.AttributeType) &&
1260Annotations.GetAction(resolvedConstructor.Module.Assembly) == AssemblyAction.Link)
1269if (displayTargetType == null || !Annotations.IsMarked(displayTargetType))
1330if (property != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(property.SetMethod))
1369if (field != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(field))
1415if (resolvedConstructor != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(resolvedConstructor))
1462return !Annotations.SetProcessed(provider);
1467Annotations.Mark(assembly, reason, origin);
1484var action = Annotations.GetAction(assembly);
1495else if (Annotations.IsRootAssembly(assembly))
1512Debug.Assert(Annotations.IsProcessed(assembly));
1590if (Annotations.HasMarkedAnyIndirectlyCalledMethods() && MarkDisablePrivateReflectionAttribute())
1617if (IsAttributeRemoved(customAttribute, resolved.DeclaringType) && Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1719if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1732isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode(method, out requiresUnreferencedCode);
1742isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1751isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1762isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1769bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(method);
1812bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1823bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(member);
1840Debug.Assert(Annotations.IsMarked(field));
1844Annotations.Mark(field, reason, origin);
1882if (field.IsStatic && !Annotations.HasPreservedStaticCtor(parent))
1913if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1916if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1927if (Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(field))
1940return assembly != null && Annotations.GetAction(assembly) != AssemblyAction.Link;
1947Debug.Assert(Annotations.IsMarked(module));
1951Annotations.Mark(module, reason, origin);
1984Annotations.MarkReflectionUsed(definition);
1992Annotations.MarkRelevantToVariantCasting(type);
2000Annotations.MarkReflectionUsed(methodDefinition);
2001Annotations.MarkIndirectlyCalledMethod(methodDefinition);
2022if (IsFullyPreservedAction(Annotations.GetAction(type.Module.Assembly)))
2023Annotations.SetAction(method, MethodAction.ForceParse);
2058if (propertyDefinition != null && !Annotations.IsMarked(propertyDefinition))
2126Debug.Assert(Annotations.IsMarked(type));
2129Annotations.Mark(type, reason, origin);
2137if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(type))
2327if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(resolvedAttributeType) && Annotations.GetAction(type.Module.Assembly) == AssemblyAction.Link)
2573var ifaces = Annotations.GetRecursiveInterfaces(type);
2588if (ifaces.All(Annotations.IsMarked))
2597if (Annotations.IsMarked(resolvedInterfaceType))
2641if (Annotations.IsMarked(method))
2647var base_list = Annotations.GetBaseMethods(method);
2684if (Annotations.IsMarked(method))
2690if (!((iface is not null && Annotations.IsMarked(iface))
2696if (!Annotations.IsMarked(@base) && !IgnoreScope(@base.DeclaringType.Scope))
2707return Annotations.IsRelevantToVariantCasting(overrideInformation.InterfaceImplementor.Implementor)
2712return Annotations.IsInstantiated(overrideInformation.InterfaceImplementor.Implementor);
2963if (Annotations.TryGetPreserve(type, out TypePreserve preserve))
2965if (!Annotations.SetAppliedPreserve(type, preserve))
2988if (Annotations.TryGetPreservedMembers(type, out TypePreserveMembers members))
3061var list = Annotations.GetPreservedMethods(type);
3065Annotations.ClearPreservedMethods(type);
3071var list = Annotations.GetPreservedMethods(method);
3075Annotations.ClearPreservedMethods(method);
3168var methodAction = Annotations.GetAction(method);
3175Annotations.TryGetMethodStubValue(method, out _);
3179Annotations.SetAction(method, MethodAction.Parse);
3190Debug.Assert(Annotations.IsMarked(method));
3193Annotations.Mark(method, reason, origin);
3373else if (method.IsStaticConstructor() && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3375else if (method == method.Module.EntryPoint && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3380if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker(method))
3381Annotations.ProcessSatelliteAssemblies = true;
3402bool markAllOverrides = assembly != null && Annotations.GetAction(assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3430if (Annotations.GetOverrides(method) is IEnumerable<OverrideInformation> overrides)
3432foreach (var @override in overrides.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope)))
3521if (Annotations.IsInstantiated(type))
3524Annotations.MarkInstantiated(type);
3553var ifaces = Annotations.GetRecursiveInterfaces(method.DeclaringType);
3568switch (Annotations.GetAction(method))
3635var base_methods = Annotations.GetBaseMethods(method);
3661Annotations.MarkProcessed(pii.Module, new DependencyInfo(DependencyKind.InteropMethodDependency, method));
3727switch (Annotations.GetAction(method))
3735switch (Annotations.GetAction(assembly))
3753if (!Annotations.MarkProcessed(prop, reason))
3772if (!Annotations.MarkProcessed(evt, reason))
3869if (!Annotations.IsProcessed(methodIL.Method))
3876Debug.Assert(Annotations.IsProcessed(owningMethod));
3912&& !Annotations.IsInstantiated(methodIL.Method.DeclaringType)
4057if (!Annotations.IsInstantiated(type))
4082if (Annotations.IsMarked(iface))
4084Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(DependencyKind.InterfaceImplementationOnType, origin.Provider));