Linker.Steps\MarkStep.cs (131)
276 Annotations.SetAction (body.Method, MethodAction.ConvertToThrow);
294 if (Annotations.TryGetPreserve (type, out TypePreserve preserve) && preserve == TypePreserve.All)
297 switch (Annotations.GetAction (type.Module.Assembly)) {
387 Debug.Assert (Annotations.GetAction (assembly) == action);
401 var action = Annotations.GetAction (assembly);
404 if (!Annotations.IsProcessed (assembly))
431 foreach (var pending in Annotations.GetMarkedPending ()) {
435 if (Annotations.IsProcessed (pending.Key))
453 Annotations.SetProcessed (exportedType);
461 foreach (var type in Annotations.GetPendingPreserve ()) {
474 if (Annotations.IsInstantiated (type))
529 if (Annotations.IsInstantiated (type) || Annotations.IsRelevantToVariantCasting (type) ||
535 var baseMethods = Annotations.GetBaseMethods (method);
551 switch (Annotations.GetAction (assembly)) {
569 if (!Annotations.IsMarked (type) && TypeIsDynamicInterfaceCastableImplementation (type))
592 if (Annotations.IsMarked (type)) {
598 if (Annotations.IsMarked (iface.InterfaceType)) {
614 if (Annotations.IsInstantiated (body.Method.DeclaringType)) {
624 Annotations.EnqueueVirtualMethod (method);
633 var defaultImplementations = Annotations.GetDefaultInterfaceImplementations (method);
642 List<OverrideInformation>? overridingMethods = (List<OverrideInformation>?) Annotations.GetOverrides (method);
660 Debug.Assert (Annotations.IsMarked (overrideInformation.Base) || IgnoreScope (overrideInformation.Base.DeclaringType.Scope));
661 if (!Annotations.IsMarked (overrideInformation.Override.DeclaringType))
672 if (Annotations.IsInstantiated (overrideInformation.Override.DeclaringType))
690 if (Context.IsOptimizationEnabled (CodeOptimizations.OverrideRemoval, overrideInformation.Override) && Annotations.IsInstantiated (overrideInformation.Override.DeclaringType)) {
701 Debug.Assert (Annotations.IsMarked (method.DeclaringType));
703 var bases = Annotations.GetBaseMethods (method);
707 var markedBaseMethods = bases.Where (ov => Annotations.IsMarked (ov.Base) || IgnoreScope (ov.Base.DeclaringType.Scope));
748 if ((!ov.Override.IsStatic && !Annotations.IsInstantiated (ov.InterfaceImplementor.Implementor))
749 || ov.Override.IsStatic && !Annotations.IsRelevantToVariantCasting (ov.InterfaceImplementor.Implementor))
773 bool providerInLinkedAssembly = Annotations.GetAction (CustomAttributeSource.GetAssemblyFromCustomAttributeProvider (provider)) == AssemblyAction.Link;
802 foreach (var dynamicDependency in Annotations.GetLinkerAttributes<DynamicDependency> (providerMember))
808 foreach (var attr in Annotations.GetLinkerAttributes<RemoveAttributeInstancesAttribute> (attributeType)) {
1064 Annotations.Mark (ca, reason);
1103 if (type is null || !Annotations.IsMarked (type))
1112 if (Annotations.HasPreservedStaticCtor (type))
1124 Annotations.SetPreservedStaticCtor (type);
1136 if (!Annotations.IsMarked (resolvedConstructor.Module) &&
1137 !Annotations.IsMarked (ca.AttributeType) &&
1138 Annotations.GetAction (resolvedConstructor.Module.Assembly) == AssemblyAction.Link)
1145 if (displayTargetType == null || !Annotations.IsMarked (displayTargetType))
1205 if (property != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis (property.SetMethod)) {
1242 if (field != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis (field)) {
1285 if (resolvedConstructor != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis (resolvedConstructor)) {
1328 return !Annotations.SetProcessed (provider);
1333 Annotations.Mark (assembly, reason, origin);
1350 var action = Annotations.GetAction (assembly);
1358 } else if (Annotations.IsRootAssembly (assembly)) {
1374 Debug.Assert (Annotations.IsProcessed (assembly));
1449 if (Annotations.HasMarkedAnyIndirectlyCalledMethods () && MarkDisablePrivateReflectionAttribute ())
1474 if (IsAttributeRemoved (customAttribute, resolved.DeclaringType) && Annotations.GetAction (CustomAttributeSource.GetAssemblyFromCustomAttributeProvider (assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1567 if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (origin.Provider, out _))
1579 isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode (method, out requiresUnreferencedCode);
1589 isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (method, out requiresUnreferencedCode);
1597 isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (method, out requiresUnreferencedCode);
1604 bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection (method);
1644 bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1654 bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection (member);
1669 Debug.Assert (Annotations.IsMarked (field));
1671 Annotations.Mark (field, reason, origin);
1707 if (field.IsStatic && !Annotations.HasPreservedStaticCtor (parent)) {
1735 if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (origin.Provider, out _))
1738 if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1748 if (Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection (field))
1761 return assembly != null && Annotations.GetAction (assembly) != AssemblyAction.Link;
1767 Debug.Assert (Annotations.IsMarked (module));
1769 Annotations.Mark (module, reason, origin);
1799 Annotations.MarkRelevantToVariantCasting (definition);
1800 Annotations.MarkReflectionUsed (definition);
1809 Annotations.MarkReflectionUsed (methodDefinition);
1810 Annotations.MarkIndirectlyCalledMethod (methodDefinition);
1820 if (IsFullyPreservedAction (Annotations.GetAction (type.Module.Assembly)))
1821 Annotations.SetAction (method, MethodAction.ForceParse);
1847 if (propertyDefinition != null && !Annotations.IsMarked (propertyDefinition))
1914 Debug.Assert (Annotations.IsMarked (type));
1917 Annotations.Mark (type, reason, origin);
1925 if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute> (type)) {
1960 !Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute> (type) &&
1961 Annotations.TryGetLinkerAttribute (baseType, out RequiresUnreferencedCodeAttribute? effectiveRequiresUnreferencedCode)) {
2102 if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute> (resolvedAttributeType) && Annotations.GetAction (type.Module.Assembly) == AssemblyAction.Link)
2323 var ifaces = Annotations.GetRecursiveInterfaces (type);
2337 if (ifaces.All (Annotations.IsMarked))
2346 if (Annotations.IsMarked (resolvedInterfaceType))
2389 if (Annotations.IsMarked (method))
2395 var base_list = Annotations.GetBaseMethods (method);
2431 if (Annotations.IsMarked (method))
2437 if (!((iface is not null && Annotations.IsMarked (iface))
2443 if (!Annotations.IsMarked (@base) && !IgnoreScope (@base.DeclaringType.Scope))
2454 return Annotations.IsRelevantToVariantCasting (overrideInformation.InterfaceImplementor.Implementor)
2459 return Annotations.IsInstantiated (overrideInformation.InterfaceImplementor.Implementor);
2670 if (parameter is not null && Annotations.FlowAnnotations.RequiresGenericArgumentDataFlowAnalysis (parameter)) {
2682 Annotations.MarkRelevantToVariantCasting (argumentTypeDef);
2704 if (Annotations.TryGetPreserve (type, out TypePreserve preserve)) {
2705 if (!Annotations.SetAppliedPreserve (type, preserve))
2727 if (Annotations.TryGetPreservedMembers (type, out TypePreserveMembers members)) {
2789 var list = Annotations.GetPreservedMethods (type);
2793 Annotations.ClearPreservedMethods (type);
2799 var list = Annotations.GetPreservedMethods (method);
2803 Annotations.ClearPreservedMethods (method);
2872 Annotations.MarkRelevantToVariantCasting (typeDefinition);
2889 var methodAction = Annotations.GetAction (method);
2895 Annotations.TryGetMethodStubValue (method, out _);
2899 Annotations.SetAction (method, MethodAction.Parse);
2909 Debug.Assert (Annotations.IsMarked (method));
2912 Annotations.Mark (method, reason, origin);
3085 } else if (method.IsStaticConstructor () && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute> (method))
3087 else if (method == method.Module.EntryPoint && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute>(method))
3091 if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker (method))
3092 Annotations.ProcessSatelliteAssemblies = true;
3109 bool markAllOverrides = assembly != null && Annotations.GetAction (assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3136 if (Annotations.GetOverrides (method) is IEnumerable<OverrideInformation> overrides) {
3137 foreach (var @override in overrides.Where (ov => Annotations.IsMarked (ov.Base) || IgnoreScope (ov.Base.DeclaringType.Scope))) {
3220 if (Annotations.IsInstantiated (type))
3223 Annotations.MarkInstantiated (type);
3247 var ifaces = Annotations.GetRecursiveInterfaces (method.DeclaringType);
3260 switch (Annotations.GetAction (method)) {
3326 var base_methods = Annotations.GetBaseMethods (method);
3349 Annotations.MarkProcessed (pii.Module, new DependencyInfo (DependencyKind.InteropMethodDependency, method));
3406 switch (Annotations.GetAction (method)) {
3413 switch (Annotations.GetAction (assembly)) {
3430 if (!Annotations.MarkProcessed (prop, reason))
3449 if (!Annotations.MarkProcessed (evt, reason))
3520 if (!Annotations.IsProcessed (methodIL.Method)) {
3526 Debug.Assert (Annotations.IsProcessed (owningMethod));
3562 && !Annotations.IsInstantiated (methodIL.Method.DeclaringType)
3654 Annotations.MarkRelevantToVariantCasting (typeDefinition);
3671 if (!Annotations.IsInstantiated (type)) {
3694 if (Annotations.IsMarked (iface))
3696 Annotations.MarkProcessed (iface, reason ?? new DependencyInfo (DependencyKind.InterfaceImplementationOnType, origin.Provider));