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);
1497else if (Annotations.IsRootAssembly(assembly))
1514Debug.Assert(Annotations.IsProcessed(assembly));
1597if (Annotations.HasMarkedAnyIndirectlyCalledMethods() && MarkDisablePrivateReflectionAttribute())
1624if (IsAttributeRemoved(customAttribute, resolved.DeclaringType) && Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1726if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1739isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode(method, out requiresUnreferencedCode);
1749isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1758isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1769isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1776bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(method);
1819bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1830bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(member);
1847Debug.Assert(Annotations.IsMarked(field));
1851Annotations.Mark(field, reason, origin);
1889if (field.IsStatic && !Annotations.HasPreservedStaticCtor(parent))
1920if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1923if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1934if (Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(field))
1947return assembly != null && Annotations.GetAction(assembly) != AssemblyAction.Link;
1954Debug.Assert(Annotations.IsMarked(module));
1958Annotations.Mark(module, reason, origin);
1991Annotations.MarkReflectionUsed(definition);
1999Annotations.MarkRelevantToVariantCasting(type);
2007Annotations.MarkReflectionUsed(methodDefinition);
2008Annotations.MarkIndirectlyCalledMethod(methodDefinition);
2029if (IsFullyPreservedAction(Annotations.GetAction(type.Module.Assembly)))
2030Annotations.SetAction(method, MethodAction.ForceParse);
2065if (propertyDefinition != null && !Annotations.IsMarked(propertyDefinition))
2133Debug.Assert(Annotations.IsMarked(type));
2136Annotations.Mark(type, reason, origin);
2144if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(type))
2333if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(resolvedAttributeType) && Annotations.GetAction(type.Module.Assembly) == AssemblyAction.Link)
2579var ifaces = Annotations.GetRecursiveInterfaces(type);
2594if (ifaces.All(Annotations.IsMarked))
2603if (Annotations.IsMarked(resolvedInterfaceType))
2647if (Annotations.IsMarked(method))
2653var base_list = Annotations.GetBaseMethods(method);
2690if (Annotations.IsMarked(method))
2696if (!((iface is not null && Annotations.IsMarked(iface))
2702if (!Annotations.IsMarked(@base) && !IgnoreScope(@base.DeclaringType.Scope))
2713return Annotations.IsRelevantToVariantCasting(overrideInformation.InterfaceImplementor.Implementor)
2718return Annotations.IsInstantiated(overrideInformation.InterfaceImplementor.Implementor);
2962if (Annotations.TryGetPreserve(type, out TypePreserve preserve))
2964if (!Annotations.SetAppliedPreserve(type, preserve))
2987if (Annotations.TryGetPreservedMembers(type, out TypePreserveMembers members))
3060var list = Annotations.GetPreservedMethods(type);
3064Annotations.ClearPreservedMethods(type);
3070var list = Annotations.GetPreservedMethods(method);
3074Annotations.ClearPreservedMethods(method);
3167var methodAction = Annotations.GetAction(method);
3174Annotations.TryGetMethodStubValue(method, out _);
3178Annotations.SetAction(method, MethodAction.Parse);
3189Debug.Assert(Annotations.IsMarked(method));
3192Annotations.Mark(method, reason, origin);
3372else if (method.IsStaticConstructor() && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3374else if (method == method.Module.EntryPoint && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3379if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker(method))
3380Annotations.ProcessSatelliteAssemblies = true;
3401bool markAllOverrides = assembly != null && Annotations.GetAction(assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3429if (Annotations.GetOverrides(method) is IEnumerable<OverrideInformation> overrides)
3431foreach (var @override in overrides.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope)))
3520if (Annotations.IsInstantiated(type))
3523Annotations.MarkInstantiated(type);
3552var ifaces = Annotations.GetRecursiveInterfaces(method.DeclaringType);
3567switch (Annotations.GetAction(method))
3634var base_methods = Annotations.GetBaseMethods(method);
3660Annotations.MarkProcessed(pii.Module, new DependencyInfo(DependencyKind.InteropMethodDependency, method));
3726switch (Annotations.GetAction(method))
3734switch (Annotations.GetAction(assembly))
3752if (!Annotations.MarkProcessed(prop, reason))
3771if (!Annotations.MarkProcessed(evt, reason))
3868if (!Annotations.IsProcessed(methodIL.Method))
3875Debug.Assert(Annotations.IsProcessed(owningMethod));
3911&& !Annotations.IsInstantiated(methodIL.Method.DeclaringType)
4056if (!Annotations.IsInstantiated(type))
4081if (Annotations.IsMarked(iface))
4083Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(DependencyKind.InterfaceImplementationOnType, origin.Provider));