Linker.Steps\MarkStep.cs (131)
283Annotations.SetAction(body.Method, MethodAction.ConvertToThrow);
302if (Annotations.TryGetPreserve(type, out TypePreserve preserve) && preserve == TypePreserve.All)
305switch (Annotations.GetAction(type.Module.Assembly))
405Debug.Assert(Annotations.GetAction(assembly) == action);
420var action = Annotations.GetAction(assembly);
423if (!Annotations.IsProcessed(assembly))
451foreach (var pending in Annotations.GetMarkedPending())
456if (Annotations.IsProcessed(pending.Key))
475Annotations.SetProcessed(exportedType);
483foreach (var type in Annotations.GetPendingPreserve())
498if (Annotations.IsInstantiated(type))
556if (Annotations.IsInstantiated(type) || Annotations.IsRelevantToVariantCasting(type) ||
564var baseMethods = Annotations.GetBaseMethods(method);
583switch (Annotations.GetAction(assembly))
602if (!Annotations.IsMarked(type) && TypeIsDynamicInterfaceCastableImplementation(type))
627if (Annotations.IsMarked(type))
635if (Annotations.IsMarked(iface.InterfaceType))
653if (Annotations.IsInstantiated(body.Method.DeclaringType))
664Annotations.EnqueueVirtualMethod(method);
674var defaultImplementations = Annotations.GetDefaultInterfaceImplementations(method);
685List<OverrideInformation>? overridingMethods = (List<OverrideInformation>?)Annotations.GetOverrides(method);
705Debug.Assert(Annotations.IsMarked(overrideInformation.Base) || IgnoreScope(overrideInformation.Base.DeclaringType.Scope));
706if (!Annotations.IsMarked(overrideInformation.Override.DeclaringType))
717if (Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
735if (Context.IsOptimizationEnabled(CodeOptimizations.OverrideRemoval, overrideInformation.Override) && Annotations.IsInstantiated(overrideInformation.Override.DeclaringType))
749Debug.Assert(Annotations.IsMarked(method.DeclaringType));
751var bases = Annotations.GetBaseMethods(method);
755var markedBaseMethods = bases.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope));
799if ((!ov.Override.IsStatic && !Annotations.IsInstantiated(ov.InterfaceImplementor.Implementor))
800|| ov.Override.IsStatic && !Annotations.IsRelevantToVariantCasting(ov.InterfaceImplementor.Implementor))
827bool providerInLinkedAssembly = Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(provider)) == AssemblyAction.Link;
859foreach (var dynamicDependency in Annotations.GetLinkerAttributes<DynamicDependency>(providerMember))
865foreach (var attr in Annotations.GetLinkerAttributes<RemoveAttributeInstancesAttribute>(attributeType))
1167Annotations.Mark(ca, reason);
1209if (type is null || !Annotations.IsMarked(type))
1218if (Annotations.HasPreservedStaticCtor(type))
1230Annotations.SetPreservedStaticCtor(type);
1242if (!Annotations.IsMarked(resolvedConstructor.Module) &&
1243!Annotations.IsMarked(ca.AttributeType) &&
1244Annotations.GetAction(resolvedConstructor.Module.Assembly) == AssemblyAction.Link)
1253if (displayTargetType == null || !Annotations.IsMarked(displayTargetType))
1314if (property != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(property.SetMethod))
1353if (field != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(field))
1399if (resolvedConstructor != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis(resolvedConstructor))
1446return !Annotations.SetProcessed(provider);
1451Annotations.Mark(assembly, reason, origin);
1468var action = Annotations.GetAction(assembly);
1479else if (Annotations.IsRootAssembly(assembly))
1496Debug.Assert(Annotations.IsProcessed(assembly));
1574if (Annotations.HasMarkedAnyIndirectlyCalledMethods() && MarkDisablePrivateReflectionAttribute())
1601if (IsAttributeRemoved(customAttribute, resolved.DeclaringType) && Annotations.GetAction(CustomAttributeSource.GetAssemblyFromCustomAttributeProvider(assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1703if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1716isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode(method, out requiresUnreferencedCode);
1726isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1734isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(method, out requiresUnreferencedCode);
1741bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(method);
1784bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1795bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(member);
1812Debug.Assert(Annotations.IsMarked(field));
1816Annotations.Mark(field, reason, origin);
1854if (field.IsStatic && !Annotations.HasPreservedStaticCtor(parent))
1885if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(origin.Provider, out _))
1888if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode(field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1899if (Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection(field))
1912return assembly != null && Annotations.GetAction(assembly) != AssemblyAction.Link;
1919Debug.Assert(Annotations.IsMarked(module));
1923Annotations.Mark(module, reason, origin);
1955Annotations.MarkRelevantToVariantCasting(definition);
1956Annotations.MarkReflectionUsed(definition);
1966Annotations.MarkReflectionUsed(methodDefinition);
1967Annotations.MarkIndirectlyCalledMethod(methodDefinition);
1978if (IsFullyPreservedAction(Annotations.GetAction(type.Module.Assembly)))
1979Annotations.SetAction(method, MethodAction.ForceParse);
2007if (propertyDefinition != null && !Annotations.IsMarked(propertyDefinition))
2075Debug.Assert(Annotations.IsMarked(type));
2078Annotations.Mark(type, reason, origin);
2086if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(type))
2122!Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(type) &&
2123Annotations.TryGetLinkerAttribute(baseType, out RequiresUnreferencedCodeAttribute? effectiveRequiresUnreferencedCode))
2282if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute>(resolvedAttributeType) && Annotations.GetAction(type.Module.Assembly) == AssemblyAction.Link)
2528var ifaces = Annotations.GetRecursiveInterfaces(type);
2543if (ifaces.All(Annotations.IsMarked))
2552if (Annotations.IsMarked(resolvedInterfaceType))
2596if (Annotations.IsMarked(method))
2602var base_list = Annotations.GetBaseMethods(method);
2639if (Annotations.IsMarked(method))
2645if (!((iface is not null && Annotations.IsMarked(iface))
2651if (!Annotations.IsMarked(@base) && !IgnoreScope(@base.DeclaringType.Scope))
2662return Annotations.IsRelevantToVariantCasting(overrideInformation.InterfaceImplementor.Implementor)
2667return Annotations.IsInstantiated(overrideInformation.InterfaceImplementor.Implementor);
2894if (parameter is not null && Annotations.FlowAnnotations.RequiresGenericArgumentDataFlowAnalysis(parameter))
2907Annotations.MarkRelevantToVariantCasting(argumentTypeDef);
2929if (Annotations.TryGetPreserve(type, out TypePreserve preserve))
2931if (!Annotations.SetAppliedPreserve(type, preserve))
2954if (Annotations.TryGetPreservedMembers(type, out TypePreserveMembers members))
3027var list = Annotations.GetPreservedMethods(type);
3031Annotations.ClearPreservedMethods(type);
3037var list = Annotations.GetPreservedMethods(method);
3041Annotations.ClearPreservedMethods(method);
3116Annotations.MarkRelevantToVariantCasting(typeDefinition);
3134var methodAction = Annotations.GetAction(method);
3141Annotations.TryGetMethodStubValue(method, out _);
3145Annotations.SetAction(method, MethodAction.Parse);
3156Debug.Assert(Annotations.IsMarked(method));
3159Annotations.Mark(method, reason, origin);
3339else if (method.IsStaticConstructor() && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3341else if (method == method.Module.EntryPoint && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3346if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker(method))
3347Annotations.ProcessSatelliteAssemblies = true;
3368bool markAllOverrides = assembly != null && Annotations.GetAction(assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3396if (Annotations.GetOverrides(method) is IEnumerable<OverrideInformation> overrides)
3398foreach (var @override in overrides.Where(ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope)))
3487if (Annotations.IsInstantiated(type))
3490Annotations.MarkInstantiated(type);
3515var ifaces = Annotations.GetRecursiveInterfaces(method.DeclaringType);
3530switch (Annotations.GetAction(method))
3597var base_methods = Annotations.GetBaseMethods(method);
3623Annotations.MarkProcessed(pii.Module, new DependencyInfo(DependencyKind.InteropMethodDependency, method));
3689switch (Annotations.GetAction(method))
3697switch (Annotations.GetAction(assembly))
3715if (!Annotations.MarkProcessed(prop, reason))
3734if (!Annotations.MarkProcessed(evt, reason))
3808if (!Annotations.IsProcessed(methodIL.Method))
3815Debug.Assert(Annotations.IsProcessed(owningMethod));
3851&& !Annotations.IsInstantiated(methodIL.Method.DeclaringType)
3958Annotations.MarkRelevantToVariantCasting(typeDefinition);
3975if (!Annotations.IsInstantiated(type))
4000if (Annotations.IsMarked(iface))
4002Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(DependencyKind.InterfaceImplementationOnType, origin.Provider));