Linker.Steps\MarkStep.cs (133)
291 Annotations.SetAction (body.Method, MethodAction.ConvertToThrow);
309 if (Annotations.TryGetPreserve (type, out TypePreserve preserve) && preserve == TypePreserve.All)
312 switch (Annotations.GetAction (type.Module.Assembly)) {
362 if (IsFullyPreservedAction (Annotations.GetAction (type.Module.Assembly)))
363 Annotations.SetAction (method, MethodAction.ForceParse);
425 Debug.Assert (Annotations.GetAction (assembly) == action);
439 var action = Annotations.GetAction (assembly);
442 if (!Annotations.IsProcessed (assembly))
471 foreach (var pending in Annotations.GetMarkedPending ()) {
475 if (Annotations.IsProcessed (pending.Key))
495 Annotations.SetProcessed (exportedType);
503 foreach (var type in Annotations.GetPendingPreserve ()) {
505 Debug.Assert (Annotations.IsProcessed (type));
517 if (Annotations.IsInstantiated (type))
558 if (Annotations.IsInstantiated (type) || Annotations.IsRelevantToVariantCasting (type) ||
564 var baseMethods = Annotations.GetBaseMethods (method);
581 switch (Annotations.GetAction (assembly)) {
599 if (!Annotations.IsMarked (type) && TypeIsDynamicInterfaceCastableImplementation (type))
622 if (Annotations.IsMarked (type)) {
628 if (Annotations.IsMarked (iface.InterfaceType)) {
644 if (Annotations.IsInstantiated (body.Method.DeclaringType)) {
654 Annotations.EnqueueVirtualMethod (method);
663 var defaultImplementations = Annotations.GetDefaultInterfaceImplementations (method);
672 List<OverrideInformation>? overridingMethods = (List<OverrideInformation>?)Annotations.GetOverrides (method);
690 Debug.Assert (Annotations.IsMarked (overrideInformation.Base) || IgnoreScope (overrideInformation.Base.DeclaringType.Scope));
691 if (!Annotations.IsMarked (overrideInformation.Override.DeclaringType))
702 if (Annotations.IsInstantiated (overrideInformation.Override.DeclaringType))
720 if (Context.IsOptimizationEnabled (CodeOptimizations.OverrideRemoval, overrideInformation.Override) && Annotations.IsInstantiated (overrideInformation.Override.DeclaringType)) {
731 Debug.Assert (Annotations.IsMarked (method.DeclaringType));
733 var bases = Annotations.GetBaseMethods (method);
737 var markedBaseMethods = bases.Where (ov => Annotations.IsMarked (ov.Base) || IgnoreScope (ov.Base.DeclaringType.Scope));
756 if (Annotations.IsMarked (intf) && RequiresInterfaceRecursively (resolvedInterface, interfaceType))
786 if ((!ov.Override.IsStatic && !Annotations.IsInstantiated (ov.InterfaceImplementor.Implementor))
787 || ov.Override.IsStatic && !Annotations.IsRelevantToVariantCasting (ov.InterfaceImplementor.Implementor))
811 bool providerInLinkedAssembly = Annotations.GetAction (CustomAttributeSource.GetAssemblyFromCustomAttributeProvider (provider)) == AssemblyAction.Link;
840 foreach (var dynamicDependency in Annotations.GetLinkerAttributes<DynamicDependency> (providerMember))
846 foreach (var attr in Annotations.GetLinkerAttributes<RemoveAttributeInstancesAttribute> (attributeType)) {
1102 Annotations.Mark (ca, reason);
1141 if (type is null || !Annotations.IsMarked (type))
1150 if (Annotations.HasPreservedStaticCtor (type))
1162 Annotations.SetPreservedStaticCtor (type);
1174 if (!Annotations.IsMarked (resolvedConstructor.Module) &&
1175 !Annotations.IsMarked (ca.AttributeType) &&
1176 Annotations.GetAction (resolvedConstructor.Module.Assembly) == AssemblyAction.Link)
1183 if (displayTargetType == null || !Annotations.IsMarked (displayTargetType))
1243 if (property != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis (property.SetMethod)) {
1280 if (field != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis (field)) {
1323 if (resolvedConstructor != null && Annotations.FlowAnnotations.RequiresDataFlowAnalysis (resolvedConstructor)) {
1366 return !Annotations.SetProcessed (provider);
1371 Annotations.Mark (assembly, reason, ScopeStack.CurrentScope.Origin);
1388 var action = Annotations.GetAction (assembly);
1396 } else if (Annotations.IsRootAssembly (assembly)) {
1412 Debug.Assert (Annotations.IsProcessed (assembly));
1487 if (Annotations.HasMarkedAnyIndirectlyCalledMethods () && MarkDisablePrivateReflectionAttribute ())
1512 if (IsAttributeRemoved (customAttribute, resolved.DeclaringType) && Annotations.GetAction (CustomAttributeSource.GetAssemblyFromCustomAttributeProvider (assemblyLevelAttribute.Provider)) == AssemblyAction.Link)
1607 if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (origin.Provider, out _))
1619 isReflectionAccessCoveredByRUC = Annotations.DoesMethodRequireUnreferencedCode (method, out requiresUnreferencedCode);
1629 isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (method, out requiresUnreferencedCode);
1637 isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (method, out requiresUnreferencedCode);
1644 bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection (method);
1698 bool isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (member, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute);
1708 bool isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection (member);
1740 Debug.Assert (Annotations.IsMarked (field));
1742 Annotations.Mark (field, reason, origin);
1778 if (field.IsStatic && !Annotations.HasPreservedStaticCtor (parent)) {
1787 if (Annotations.HasSubstitutedInit (field)) {
1788 Annotations.SetPreservedStaticCtor (parent);
1789 Annotations.SetSubstitutedInit (parent);
1808 return Annotations.FlowAnnotations.IsTypeInterestingForDataflow (field.FieldType);
1833 if (Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (origin.Provider, out _))
1837 if (isReflectionAccessCoveredByRUC = Annotations.ShouldSuppressAnalysisWarningsForRequiresUnreferencedCode (field, out RequiresUnreferencedCodeAttribute? requiresUnreferencedCodeAttribute))
1848 if (isReflectionAccessCoveredByDAM = Annotations.FlowAnnotations.ShouldWarnWhenAccessedForReflection (field))
1870 return assembly != null && Annotations.GetAction (assembly) != AssemblyAction.Link;
1876 Debug.Assert (Annotations.IsMarked (module));
1878 Annotations.Mark (module, reason, ScopeStack.CurrentScope.Origin);
1906 Annotations.MarkRelevantToVariantCasting (definition);
1908 Annotations.MarkReflectionUsed (definition);
1919 Annotations.MarkReflectionUsed (methodDefinition);
1920 Annotations.MarkIndirectlyCalledMethod (methodDefinition);
1991 Debug.Assert (Annotations.IsMarked (type));
1994 Annotations.Mark (type, reason, ScopeStack.CurrentScope.Origin);
2002 if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute> (type)) {
2043 !Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute> (type) &&
2044 Annotations.TryGetLinkerAttribute (baseType, out RequiresUnreferencedCodeAttribute? effectiveRequiresUnreferencedCode)) {
2193 if (Annotations.HasLinkerAttribute<RemoveAttributeInstancesAttribute> (resolvedAttributeType) && Annotations.GetAction (type.Module.Assembly) == AssemblyAction.Link)
2421 var ifaces = Annotations.GetRecursiveInterfaces (type);
2435 if (ifaces.All (Annotations.IsMarked))
2444 if (Annotations.IsMarked (resolvedInterfaceType))
2487 if (Annotations.IsMarked (method))
2493 var base_list = Annotations.GetBaseMethods (method);
2529 if (Annotations.IsMarked (method))
2535 if (!((iface is not null && Annotations.IsMarked (iface))
2541 if (!Annotations.IsMarked (@base) && !IgnoreScope (@base.DeclaringType.Scope))
2552 return Annotations.IsRelevantToVariantCasting (overrideInformation.InterfaceImplementor.Implementor)
2557 return Annotations.IsInstantiated (overrideInformation.InterfaceImplementor.Implementor);
2772 if (Annotations.FlowAnnotations.RequiresGenericArgumentDataFlowAnalysis (parameter)) {
2806 if (Annotations.TryGetPreserve (type, out TypePreserve preserve)) {
2807 if (!Annotations.SetAppliedPreserve (type, preserve))
2829 if (Annotations.TryGetPreservedMembers (type, out TypePreserveMembers members)) {
2891 var list = Annotations.GetPreservedMethods (type);
2895 Annotations.ClearPreservedMethods (type);
2901 var list = Annotations.GetPreservedMethods (method);
2905 Annotations.ClearPreservedMethods (method);
2927 if (propertyDefinition != null && !Annotations.IsMarked (propertyDefinition))
2987 Annotations.MarkRelevantToVariantCasting (typeDefinition);
3004 if (Annotations.GetAction (method) == MethodAction.Nothing)
3005 Annotations.SetAction (method, MethodAction.Parse);
3015 Debug.Assert (Annotations.IsMarked (method));
3018 Annotations.Mark (method, reason, origin);
3196 } else if (method.IsStaticConstructor () && Annotations.HasLinkerAttribute<RequiresUnreferencedCodeAttribute> (method))
3200 if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker (method))
3201 Annotations.ProcessSatelliteAssemblies = true;
3221 bool markAllOverrides = assembly != null && Annotations.GetAction (assembly) is AssemblyAction.Copy or AssemblyAction.CopyUsed or AssemblyAction.Save;
3244 if (Annotations.GetOverrides (method) is IEnumerable<OverrideInformation> overrides) {
3245 foreach (var @override in overrides.Where (ov => Annotations.IsMarked (ov.Base) || IgnoreScope (ov.Base.DeclaringType.Scope))) {
3328 if (Annotations.IsInstantiated (type))
3331 Annotations.MarkInstantiated (type);
3369 switch (Annotations.GetAction (method)) {
3436 var base_methods = Annotations.GetBaseMethods (method);
3459 Annotations.MarkProcessed (pii.Module, new DependencyInfo (DependencyKind.InteropMethodDependency, method));
3516 switch (Annotations.GetAction (method)) {
3523 switch (Annotations.GetAction (assembly)) {
3540 if (!Annotations.MarkProcessed (prop, reason))
3552 if (!Annotations.MarkProcessed (evt, reason))
3630 if (!Annotations.IsProcessed (methodIL.Method)) {
3636 Debug.Assert (Annotations.IsProcessed (owningMethod));
3672 && !Annotations.IsInstantiated (methodIL.Method.DeclaringType)
3766 Annotations.MarkRelevantToVariantCasting (typeDefinition);
3783 if (!Annotations.IsInstantiated (type)) {
3806 if (Annotations.IsMarked (iface))
3808 Annotations.MarkProcessed (iface, reason ?? new DependencyInfo (DependencyKind.InterfaceImplementationOnType, ScopeStack.CurrentScope.Origin.Provider));