378 references to DependencyKind
illink (378)
Linker.Dataflow\DynamicallyAccessedMembersTypeHierarchy.cs (3)
222
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers (origin, baseType, annotationToApplyToBase,
DependencyKind
.DynamicallyAccessedMemberOnType, declaredOnly: false);
241
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers (origin, interfaceType, annotationToApplyToInterfaces,
DependencyKind
.DynamicallyAccessedMemberOnType, declaredOnly: false);
249
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers (origin, type, annotation,
DependencyKind
.DynamicallyAccessedMemberOnType, declaredOnly: true);
Linker.Dataflow\ReflectionMarker.cs (16)
27
internal void MarkTypeForDynamicallyAccessedMembers (in MessageOrigin origin, TypeReference type, DynamicallyAccessedMemberTypes requiredMemberTypes,
DependencyKind
dependencyKind, bool declaredOnly = false)
96
_markStep.MarkTypeVisibleToReflection (typeReference, new DependencyInfo (
DependencyKind
.AccessedViaReflection, origin.Provider), origin);
98
_context.MarkingHelpers.MarkMatchingExportedType (typeResolutionRecord.ResolvedType, typeResolutionRecord.ReferringAssembly, new DependencyInfo (
DependencyKind
.DynamicallyAccessedMember, typeReference), origin);
103
internal void MarkType (in MessageOrigin origin, TypeReference typeRef,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
114
internal void MarkMethod (in MessageOrigin origin, MethodReference methodRef,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
125
void MarkField (in MessageOrigin origin, FieldDefinition field,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
133
internal void MarkProperty (in MessageOrigin origin, PropertyDefinition property,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
141
void MarkEvent (in MessageOrigin origin, EventDefinition @event,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
149
void MarkInterfaceImplementation (in MessageOrigin origin, InterfaceImplementation interfaceImplementation,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
213
_markStep.MarkStaticConstructorVisibleToReflection (type, new DependencyInfo (
DependencyKind
.AccessedViaReflection, origin.Provider), origin);
Linker.Dataflow\RequireDynamicallyAccessedMembersAction.cs (1)
40
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers (_diagnosticContext.Origin, type.Type, dynamicallyAccessedMemberTypes,
DependencyKind
.DynamicallyAccessedMember);
Linker.Steps\DescriptorMarker.cs (8)
62
_context.MarkingHelpers.MarkExportedType (exportedType, assembly.MainModule, new DependencyInfo (
DependencyKind
.XmlDescriptor, assembly.MainModule), GetMessageOriginForPosition (nav));
93
_context.Annotations.Mark (type, new DependencyInfo (
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition (nav));
105
_context.MarkingHelpers.MarkExportedType (exported, assembly.MainModule, new DependencyInfo (
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition (nav));
113
_context.MarkingHelpers.MarkExportedType (currentType, assembly.MainModule, new DependencyInfo(
DependencyKind
.DeclaringType, currentType), GetMessageOriginForPosition (nav));
148
_context.Annotations.Mark (type, new DependencyInfo (
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition (nav));
154
_context.Annotations.Mark (parent, new DependencyInfo (
DependencyKind
.DeclaringType, currentType), GetMessageOriginForPosition (nav));
176
_context.Annotations.Mark (field, new DependencyInfo (
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition (nav));
190
_context.Annotations.Mark (method, new DependencyInfo (
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition (nav));
Linker.Steps\DiscoverCustomOperatorsHandler.cs (1)
84
Context.Annotations.Mark (method, new DependencyInfo (
DependencyKind
.PreservedOperator, method.DeclaringType), new MessageOrigin (method.DeclaringType));
Linker.Steps\MarkExportedTypesTargetStep.cs (1)
36
context.Annotations.Mark (type, new DependencyInfo (
DependencyKind
.ExportedType, exportedType), new MessageOrigin (assembly));
Linker.Steps\MarkStep.cs (315)
94
static readonly
DependencyKind
[] _entireTypeReasons = new
DependencyKind
[] {
95
DependencyKind
.AccessedViaReflection,
96
DependencyKind
.BaseType,
97
DependencyKind
.PreservedDependency,
98
DependencyKind
.NestedType,
99
DependencyKind
.TypeInAssembly,
100
DependencyKind
.Unspecified,
103
static readonly
DependencyKind
[] _fieldReasons = new
DependencyKind
[] {
104
DependencyKind
.Unspecified,
105
DependencyKind
.AccessedViaReflection,
106
DependencyKind
.AlreadyMarked,
107
DependencyKind
.Custom,
108
DependencyKind
.CustomAttributeField,
109
DependencyKind
.DynamicallyAccessedMember,
110
DependencyKind
.DynamicallyAccessedMemberOnType,
111
DependencyKind
.EventSourceProviderField,
112
DependencyKind
.FieldAccess,
113
DependencyKind
.FieldOnGenericInstance,
114
DependencyKind
.InteropMethodDependency,
115
DependencyKind
.Ldtoken,
116
DependencyKind
.MemberOfType,
117
DependencyKind
.DynamicDependency,
118
DependencyKind
.ReferencedBySpecialAttribute,
119
DependencyKind
.TypePreserve,
120
DependencyKind
.XmlDescriptor,
121
DependencyKind
.UnsafeAccessorTarget,
124
static readonly
DependencyKind
[] _typeReasons = new
DependencyKind
[] {
125
DependencyKind
.Unspecified,
126
DependencyKind
.AccessedViaReflection,
127
DependencyKind
.AlreadyMarked,
128
DependencyKind
.AttributeType,
129
DependencyKind
.BaseType,
130
DependencyKind
.CatchType,
131
DependencyKind
.Custom,
132
DependencyKind
.CustomAttributeArgumentType,
133
DependencyKind
.CustomAttributeArgumentValue,
134
DependencyKind
.DeclaringType,
135
DependencyKind
.DeclaringTypeOfCalledMethod,
136
DependencyKind
.DynamicallyAccessedMember,
137
DependencyKind
.DynamicallyAccessedMemberOnType,
138
DependencyKind
.DynamicDependency,
139
DependencyKind
.ElementType,
140
DependencyKind
.FieldType,
141
DependencyKind
.GenericArgumentType,
142
DependencyKind
.GenericParameterConstraintType,
143
DependencyKind
.InterfaceImplementationInterfaceType,
144
DependencyKind
.Ldtoken,
145
DependencyKind
.ModifierType,
146
DependencyKind
.NestedType,
147
DependencyKind
.InstructionTypeRef,
148
DependencyKind
.ParameterType,
149
DependencyKind
.ReferencedBySpecialAttribute,
150
DependencyKind
.ReturnType,
151
DependencyKind
.TypeInAssembly,
152
DependencyKind
.UnreachableBodyRequirement,
153
DependencyKind
.VariableType,
154
DependencyKind
.ParameterMarshalSpec,
155
DependencyKind
.FieldMarshalSpec,
156
DependencyKind
.ReturnTypeMarshalSpec,
157
DependencyKind
.DynamicInterfaceCastableImplementation,
158
DependencyKind
.XmlDescriptor,
161
static readonly
DependencyKind
[] _methodReasons = new
DependencyKind
[] {
162
DependencyKind
.Unspecified,
163
DependencyKind
.AccessedViaReflection,
164
DependencyKind
.AlreadyMarked,
165
DependencyKind
.AttributeConstructor,
166
DependencyKind
.AttributeProperty,
167
DependencyKind
.BaseDefaultCtorForStubbedMethod,
168
DependencyKind
.BaseMethod,
169
DependencyKind
.CctorForType,
170
DependencyKind
.CctorForField,
171
DependencyKind
.Custom,
172
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument,
173
DependencyKind
.DirectCall,
174
DependencyKind
.DynamicallyAccessedMember,
175
DependencyKind
.DynamicallyAccessedMemberOnType,
176
DependencyKind
.DynamicDependency,
177
DependencyKind
.ElementMethod,
178
DependencyKind
.EventMethod,
179
DependencyKind
.EventOfEventMethod,
180
DependencyKind
.InteropMethodDependency,
181
DependencyKind
.KeptForSpecialAttribute,
182
DependencyKind
.Ldftn,
183
DependencyKind
.Ldtoken,
184
DependencyKind
.Ldvirtftn,
185
DependencyKind
.MemberOfType,
186
DependencyKind
.MethodForInstantiatedType,
187
DependencyKind
.MethodForSpecialType,
188
DependencyKind
.MethodImplOverride,
189
DependencyKind
.MethodOnGenericInstance,
190
DependencyKind
.Newobj,
191
DependencyKind
.Override,
192
DependencyKind
.OverrideOnInstantiatedType,
193
DependencyKind
.DynamicDependency,
194
DependencyKind
.PreservedMethod,
195
DependencyKind
.ReferencedBySpecialAttribute,
196
DependencyKind
.SerializationMethodForType,
197
DependencyKind
.TriggersCctorForCalledMethod,
198
DependencyKind
.TriggersCctorThroughFieldAccess,
199
DependencyKind
.TypePreserve,
200
DependencyKind
.UnreachableBodyRequirement,
201
DependencyKind
.VirtualCall,
202
DependencyKind
.VirtualNeededDueToPreservedScope,
203
DependencyKind
.ParameterMarshalSpec,
204
DependencyKind
.FieldMarshalSpec,
205
DependencyKind
.ReturnTypeMarshalSpec,
206
DependencyKind
.XmlDescriptor,
207
DependencyKind
.UnsafeAccessorTarget,
325
MarkEntireType (nested, new DependencyInfo (
DependencyKind
.NestedType, type), origin);
337
MarkFieldsVisibleToReflection (type, new DependencyInfo (
DependencyKind
.MemberOfType, type), origin);
338
MarkMethodsVisibleToReflection (type, new DependencyInfo (
DependencyKind
.MemberOfType, type), origin);
342
MarkPropertyVisibleToReflection (property, new DependencyInfo (
DependencyKind
.MemberOfType, type), origin);
348
MarkEventVisibleToReflection (ev, new DependencyInfo (
DependencyKind
.MemberOfType, type), origin);
406
MarkAssembly (assembly, new DependencyInfo (
DependencyKind
.AssemblyAction, null), emptyOrigin);
601
MarkType (type, new DependencyInfo (
DependencyKind
.DynamicInterfaceCastableImplementation, iface.InterfaceType), new MessageOrigin (Context.TryResolve (iface.InterfaceType)));
639
MarkMethod (dimInfo.Override, new DependencyInfo (
DependencyKind
.Override, dimInfo.Base), origin);
647
MarkMethod (ov.Override, new DependencyInfo (
DependencyKind
.Override, ov.Base), origin);
691
MarkMethod (overrideInformation.Override, new DependencyInfo (
DependencyKind
.OverrideOnInstantiatedType, overrideInformation.Override.DeclaringType), origin);
695
MarkMethod (overrideInformation.Override, new DependencyInfo (
DependencyKind
.Override, overrideInformation.Base), origin);
876
MarkingHelpers.MarkMatchingExportedType (type, assembly, new DependencyInfo (
DependencyKind
.DynamicDependency, type), origin);
907
MarkMembersVisibleToReflection (members, new DependencyInfo (
DependencyKind
.DynamicDependency, context), origin);
970
MarkingHelpers.MarkMatchingExportedType (td, assemblyDef, new DependencyInfo (
DependencyKind
.PreservedDependency, ca), origin);
991
MarkEntireType (td, new DependencyInfo (
DependencyKind
.PreservedDependency, ca), origin);
996
if (MarkDependencyMethod (td, member, signature, new DependencyInfo (
DependencyKind
.PreservedDependency, ca), origin))
999
if (MarkNamedField (td, member, new DependencyInfo (
DependencyKind
.PreservedDependency, ca), origin))
1065
MarkMethod (ca.Constructor, new DependencyInfo (
DependencyKind
.AttributeConstructor, ca), origin);
1183
MarkType (security_type, new DependencyInfo (
DependencyKind
.AttributeType, sa), origin);
1194
MarkCustomAttributeProperty (named_argument, attribute, ca, new DependencyInfo (
DependencyKind
.AttributeProperty, ca), origin);
1238
MarkField (field, new DependencyInfo (
DependencyKind
.CustomAttributeField, ca), origin);
1298
MarkType (et, new DependencyInfo (
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1313
MarkType (argument.Type, new DependencyInfo (
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1314
MarkType ((TypeReference) argument.Value, new DependencyInfo (
DependencyKind
.CustomAttributeArgumentValue, ca), origin);
1319
MarkType (boxed_value.Type, new DependencyInfo (
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1366
MarkSecurityDeclarations (assembly, new DependencyInfo (
DependencyKind
.AssemblyOrModuleAttribute, assembly), assemblyOrigin);
1378
MarkCustomAttributes (assembly, new DependencyInfo (
DependencyKind
.AssemblyOrModuleAttribute, assembly), origin);
1379
MarkCustomAttributes (module, new DependencyInfo (
DependencyKind
.AssemblyOrModuleAttribute, module), origin);
1382
MarkEntireType (type, new DependencyInfo (
DependencyKind
.TypeInAssembly, assembly), origin);
1411
markingHelpers.MarkExportedType (exportedType, assembly.MainModule, new DependencyInfo (
DependencyKind
.ExportedType, assembly), new MessageOrigin (assembly));
1444
MarkType (moduleType, new DependencyInfo (
DependencyKind
.TypeInAssembly, assembly), origin);
1483
MarkCustomAttribute (customAttribute, new DependencyInfo (
DependencyKind
.AssemblyOrModuleAttribute, assemblyLevelAttribute.Provider), assemblyOrigin);
1547
Debug.Assert (reason.Kind ==
DependencyKind
.FieldAccess || reason.Kind ==
DependencyKind
.Ldtoken);
1550
MarkType (reference.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringType, reference), origin);
1553
reason = new DependencyInfo (
DependencyKind
.FieldOnGenericInstance, reference);
1565
void ReportWarningsForReflectionAccess (in MessageOrigin origin, MethodDefinition method,
DependencyKind
dependencyKind)
1575
case
DependencyKind
.AttributeProperty:
1582
case
DependencyKind
.Ldftn:
1583
case
DependencyKind
.Ldvirtftn:
1584
case
DependencyKind
.Ldtoken:
1609
case
DependencyKind
.AttributeConstructor:
1610
case
DependencyKind
.AttributeProperty:
1668
if (reason.Kind ==
DependencyKind
.AlreadyMarked) {
1680
MarkType (field.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringType, field), origin);
1683
MarkType (field.FieldType, new DependencyInfo (
DependencyKind
.FieldType, field), fieldOrigin);
1684
MarkCustomAttributes (field, new DependencyInfo (
DependencyKind
.CustomAttribute, field), fieldOrigin);
1685
MarkMarshalSpec (field, new DependencyInfo (
DependencyKind
.FieldMarshalSpec, field), fieldOrigin);
1710
DependencyKind
.FieldAccess => new DependencyInfo (
DependencyKind
.TriggersCctorThroughFieldAccess, reason.Source),
1711
_ => new DependencyInfo (
DependencyKind
.CctorForField, field)
1717
void ProcessAnalysisAnnotationsForField (FieldDefinition field,
DependencyKind
dependencyKind, in MessageOrigin origin)
1721
case
DependencyKind
.AlreadyMarked:
1722
case
DependencyKind
.TypePreserve:
1723
case
DependencyKind
.PreservedMethod:
1724
case
DependencyKind
.MemberOfType:
1727
case
DependencyKind
.DynamicallyAccessedMemberOnType:
1742
case
DependencyKind
.AccessedViaReflection:
1743
case
DependencyKind
.DynamicDependency:
1744
case
DependencyKind
.DynamicallyAccessedMember:
1745
case
DependencyKind
.InteropMethodDependency:
1746
case
DependencyKind
.Ldtoken:
1747
case
DependencyKind
.UnsafeAccessorTarget:
1766
if (reason.Kind ==
DependencyKind
.AlreadyMarked) {
1773
MarkAssembly (module.Assembly, new DependencyInfo (
DependencyKind
.AssemblyOfModule, module), origin);
1785
MarkDefaultConstructor (type, new DependencyInfo (
DependencyKind
.SerializationMethodForType, type), origin);
1786
MarkMethodsIf (type.Methods, IsSpecialSerializationConstructor, new DependencyInfo (
DependencyKind
.SerializationMethodForType, type), origin);
1789
MarkMethodsIf (type.Methods, HasOnSerializeOrDeserializeAttribute, new DependencyInfo (
DependencyKind
.SerializationMethodForType, type), origin);
1913
case
DependencyKind
.AlreadyMarked:
1922
if (type.HasMethods && ShouldMarkTypeStaticConstructor (type) && reason.Kind ==
DependencyKind
.DeclaringTypeOfCalledMethod)
1923
MarkStaticConstructor (type, new DependencyInfo (
DependencyKind
.TriggersCctorForCalledMethod, reason.Source), origin);
1932
reason.Kind is not
DependencyKind
.TypeInAssembly)
1940
MarkModule (module, new DependencyInfo (
DependencyKind
.ScopeOfType, type), origin);
1947
MarkType (type.BaseType, new DependencyInfo (
DependencyKind
.BaseType, type), typeOrigin);
1955
MarkType (type.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringType, type), typeOrigin);
1956
MarkCustomAttributes (type, new DependencyInfo (
DependencyKind
.CustomAttribute, type), typeOrigin);
1957
MarkSecurityDeclarations (type, new DependencyInfo (
DependencyKind
.CustomAttribute, type), typeOrigin);
1974
MarkMethodIf (type.Methods, static m => m.Name == "Finalize", new DependencyInfo (
DependencyKind
.MethodForSpecialType, type), typeOrigin);
2024
MarkMethod (method, new DependencyInfo (
DependencyKind
.VirtualNeededDueToPreservedScope, type), typeOrigin);
2027
if (ShouldMarkTypeStaticConstructor (type) && reason.Kind !=
DependencyKind
.TriggersCctorForCalledMethod) {
2028
MarkStaticConstructor (type, new DependencyInfo (
DependencyKind
.CctorForType, type), typeOrigin);
2117
if (MarkMethodsIf (type.Methods, MethodDefinitionExtensions.IsPublicInstancePropertyMethod, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, type), origin))
2118
Tracer.AddDirectDependency (attribute, new DependencyInfo (
DependencyKind
.CustomAttribute, type), marked: false);
2141
Tracer.AddDirectDependency (attribute, new DependencyInfo (
DependencyKind
.CustomAttribute, type), marked: false);
2142
MarkNamedMethod (type, name, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2157
Tracer.AddDirectDependency (attribute, new DependencyInfo (
DependencyKind
.CustomAttribute, type), marked: false);
2197
MarkMethodVisibleToReflection (method, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2203
MarkFieldVisibleToReflection (field, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2209
MarkPropertyVisibleToReflection (property, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2217
MarkMethodsVisibleToReflection (type, new DependencyInfo (
DependencyKind
.KeptForSpecialAttribute, attribute), origin);
2218
MarkFieldsVisibleToReflection (type, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2242
Tracer.AddDirectDependency (attribute, new DependencyInfo (
DependencyKind
.CustomAttribute, type), marked: false);
2243
MarkType (proxyTypeReference, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2246
MarkMethodsVisibleToReflection (proxyType, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2247
MarkFieldsVisibleToReflection (proxyType, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2286
MarkNamedField (method.DeclaringType, member_name, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2287
MarkNamedProperty (method.DeclaringType, member_name, new DependencyInfo (
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2368
MarkCustomAttributes (parameter, new DependencyInfo (
DependencyKind
.GenericParameterCustomAttribute, parameter.Owner), origin);
2373
MarkCustomAttributes (constraint, new DependencyInfo (
DependencyKind
.GenericParameterConstraintCustomAttribute, parameter.Owner), origin);
2374
MarkType (constraint.ConstraintType, new DependencyInfo (
DependencyKind
.GenericParameterConstraintType, parameter.Owner), origin);
2607
MarkStaticFields (nestedType, new DependencyInfo (
DependencyKind
.EventSourceProviderField, td), origin);
2613
MarkMethodsIf (type.Methods, m => m.Name == ".ctor" || m.Name == "Invoke", new DependencyInfo (
DependencyKind
.MethodForSpecialType, type), origin);
2629
MarkType (fnptr.ReturnType, new DependencyInfo (
DependencyKind
.ReturnType, fnptr), origin);
2636
(type, reason) = (specification.ElementType, new DependencyInfo (
DependencyKind
.ElementType, specification));
2648
MarkType (fnptr.Parameters[i].ParameterType, new DependencyInfo (
DependencyKind
.ParameterType, fnptr), origin);
2654
MarkType (mod.ModifierType, new DependencyInfo (
DependencyKind
.ModifierType, mod), origin);
2668
var argumentTypeDef = MarkType (argument, new DependencyInfo (
DependencyKind
.GenericArgumentType, instance), origin);
2685
MarkDefaultConstructor (argumentTypeDef, new DependencyInfo (
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument, instance), origin);
2708
var di = new DependencyInfo (
DependencyKind
.TypePreserve, type);
2728
var di = new DependencyInfo (
DependencyKind
.TypePreserve, type);
2794
MarkMethodCollection (list, new DependencyInfo (
DependencyKind
.PreservedMethod, type), origin);
2804
MarkMethodCollection (list, new DependencyInfo (
DependencyKind
.PreservedMethod, method), origin);
2869
MarkType (reference.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringType, reference), origin);
2880
MarkType (reference.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringType, reference), origin);
2882
reason = new DependencyInfo (
DependencyKind
.MethodOnGenericInstance, reference);
2908
case
DependencyKind
.AlreadyMarked:
2917
reason.Kind ==
DependencyKind
.DirectCall ||
2918
reason.Kind ==
DependencyKind
.VirtualCall ||
2919
reason.Kind ==
DependencyKind
.Newobj;
2926
MarkType (method.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringTypeOfCalledMethod, method), new MessageOrigin (reason.Source as IMemberDefinition ?? method));
2930
&& reason.Kind !=
DependencyKind
.EventMethod) {
2931
var
kind = PropagateDependencyKindToAccessors (reason.Kind,
DependencyKind
.EventOfEventMethod);
2958
void ProcessAnalysisAnnotationsForMethod (MethodDefinition method,
DependencyKind
dependencyKind, in MessageOrigin origin)
2966
case
DependencyKind
.DirectCall:
2967
case
DependencyKind
.VirtualCall:
2968
case
DependencyKind
.Newobj:
2971
case
DependencyKind
.MethodForSpecialType:
2974
case
DependencyKind
.AlreadyMarked:
2975
case
DependencyKind
.TypePreserve:
2976
case
DependencyKind
.PreservedMethod:
2983
case
DependencyKind
.BaseMethod:
2984
case
DependencyKind
.MethodImplOverride:
2985
case
DependencyKind
.Override:
2986
case
DependencyKind
.OverrideOnInstantiatedType:
2992
case
DependencyKind
.MethodForInstantiatedType:
2993
case
DependencyKind
.VirtualNeededDueToPreservedScope:
3001
case
DependencyKind
.MemberOfType:
3002
case
DependencyKind
.EventMethod:
3006
case
DependencyKind
.CctorForType:
3007
case
DependencyKind
.CctorForField:
3008
case
DependencyKind
.TriggersCctorThroughFieldAccess:
3009
case
DependencyKind
.TriggersCctorForCalledMethod:
3012
case
DependencyKind
.UnreachableBodyRequirement:
3014
case
DependencyKind
.Custom:
3015
case
DependencyKind
.Unspecified:
3019
case
DependencyKind
.KeptForSpecialAttribute:
3022
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3052
(method, reason) = (specification.ElementMethod, new DependencyInfo (
DependencyKind
.ElementMethod, specification));
3068
reason.Kind ==
DependencyKind
.DirectCall ||
3069
reason.Kind ==
DependencyKind
.VirtualCall ||
3070
reason.Kind ==
DependencyKind
.Newobj;
3076
MarkType (method.DeclaringType, new DependencyInfo (
DependencyKind
.DeclaringType, method), methodOrigin);
3077
MarkCustomAttributes (method, new DependencyInfo (
DependencyKind
.CustomAttribute, method), methodOrigin);
3078
MarkSecurityDeclarations (method, new DependencyInfo (
DependencyKind
.CustomAttribute, method), methodOrigin);
3084
Tracer.AddDirectDependency (method.DeclaringType, new DependencyInfo (
DependencyKind
.InstantiatedByCtor, method), marked: false);
3094
MarkProperty (property, new DependencyInfo (PropagateDependencyKindToAccessors (reason.Kind,
DependencyKind
.PropertyOfPropertyMethod), method));
3099
MarkType (pd.ParameterType, new DependencyInfo (
DependencyKind
.ParameterType, method), methodOrigin);
3100
MarkCustomAttributes (pd, new DependencyInfo (
DependencyKind
.ParameterAttribute, method), methodOrigin);
3101
MarkMarshalSpec (pd, new DependencyInfo (
DependencyKind
.ParameterMarshalSpec, method), methodOrigin);
3122
MarkMethod (@base, new DependencyInfo (
DependencyKind
.MethodImplOverride, method), methodOrigin);
3143
MarkType (method.ReturnType, new DependencyInfo (
DependencyKind
.ReturnType, method), methodOrigin);
3144
MarkCustomAttributes (method.MethodReturnType, new DependencyInfo (
DependencyKind
.ReturnTypeAttribute, method), methodOrigin);
3145
MarkMarshalSpec (method.MethodReturnType, new DependencyInfo (
DependencyKind
.ReturnTypeMarshalSpec, method), methodOrigin);
3167
MarkMethodIf (declaringType.Methods, m => m.Name == methodPair, new DependencyInfo (
DependencyKind
.MethodForSpecialType, declaringType), methodOrigin);
3181
static
DependencyKind
PropagateDependencyKindToAccessors (
DependencyKind
parentDependencyKind,
DependencyKind
kind)
3185
case
DependencyKind
.AlreadyMarked:
3186
case
DependencyKind
.TypePreserve:
3187
case
DependencyKind
.PreservedMethod:
3188
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3203
MarkFields (type, includeStatic: type.IsEnum, reason: new DependencyInfo (
DependencyKind
.MemberOfType, type), origin);
3268
if (!MarkDefaultConstructor (baseType, new DependencyInfo (
DependencyKind
.BaseDefaultCtorForStubbedMethod, method), origin))
3274
MarkAndCacheConvertToThrowExceptionCtor (new DependencyInfo (
DependencyKind
.UnreachableBodyRequirement, method), origin);
3317
var ctor = MarkMethodIf (disablePrivateReflection.Methods, MethodDefinitionExtensions.IsDefaultConstructor, new DependencyInfo (
DependencyKind
.DisablePrivateReflectionRequirement, disablePrivateReflection), emptyOrigin);
3340
MarkMethod (ov.Base, new DependencyInfo (
DependencyKind
.BaseMethod, method), origin);
3349
Annotations.MarkProcessed (pii.Module, new DependencyInfo (
DependencyKind
.InteropMethodDependency, method));
3366
MarkDefaultConstructor (returnTypeDefinition, new DependencyInfo (
DependencyKind
.InteropMethodDependency, method), origin);
3367
MarkFields (returnTypeDefinition, includeStaticFields, new DependencyInfo (
DependencyKind
.InteropMethodDependency, method), origin);
3373
MarkFields (method.DeclaringType, includeStaticFields, new DependencyInfo (
DependencyKind
.InteropMethodDependency, method), origin);
3386
MarkFields (paramTypeDefinition, includeStaticFields, new DependencyInfo (
DependencyKind
.InteropMethodDependency, method), origin);
3388
MarkDefaultConstructor (paramTypeDefinition, new DependencyInfo (
DependencyKind
.InteropMethodDependency, method), origin);
3436
MarkCustomAttributes (prop, new DependencyInfo (
DependencyKind
.CustomAttribute, prop), propertyOrigin);
3443
DependencyKind
dependencyKind =
DependencyKind
.EventMethod;
3453
MarkCustomAttributes (evt, new DependencyInfo (
DependencyKind
.CustomAttribute, evt), eventOrigin);
3470
MarkAndCacheConvertToThrowExceptionCtor (new DependencyInfo (
DependencyKind
.UnreachableBodyRequirement, body.Method), origin);
3536
MarkType (var.VariableType, new DependencyInfo (
DependencyKind
.VariableType, methodIL.Method), origin);
3540
MarkType (eh.CatchType, new DependencyInfo (
DependencyKind
.CatchType, methodIL.Method), origin);
3605
MarkField ((FieldReference) instruction.Operand, new DependencyInfo (
DependencyKind
.FieldAccess, method), origin);
3609
(
DependencyKind
dependencyKind, bool markForReflectionAccess) = instruction.OpCode.Code switch {
3610
Code.Jmp => (
DependencyKind
.DirectCall, false),
3611
Code.Call => (
DependencyKind
.DirectCall, false),
3612
Code.Callvirt => (
DependencyKind
.VirtualCall, false),
3613
Code.Newobj => (
DependencyKind
.Newobj, false),
3614
Code.Ldvirtftn => (
DependencyKind
.Ldvirtftn, true),
3615
Code.Ldftn => (
DependencyKind
.Ldftn, true),
3636
var reason = new DependencyInfo (
DependencyKind
.Ldtoken, method);
3680
MarkType (operand, new DependencyInfo (
DependencyKind
.InstructionTypeRef, method), origin);
3696
Annotations.MarkProcessed (iface, reason ?? new DependencyInfo (
DependencyKind
.InterfaceImplementationOnType, origin.Provider));
3699
MarkCustomAttributes (iface, new DependencyInfo (
DependencyKind
.CustomAttribute, iface), origin);
3701
MarkType (iface.InterfaceType, reason ?? new DependencyInfo (
DependencyKind
.InterfaceImplementationInterfaceType, iface), origin);
Linker.Steps\ProcessReferencesStep.cs (1)
48
Annotations.Mark (assembly.MainModule, new DependencyInfo (
DependencyKind
.AssemblyAction, assembly), new MessageOrigin (assembly));
Linker.Steps\ReflectionBlockedStep.cs (1)
75
Annotations.Mark (ca, new DependencyInfo (
DependencyKind
.DisablePrivateReflection, ca));
Linker.Steps\RootAssemblyInputStep.cs (5)
27
var di = new DependencyInfo (
DependencyKind
.RootAssembly, assembly);
139
Annotations.Mark (type, new DependencyInfo (
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin (type.Module.Assembly));
155
Annotations.Mark (type, new DependencyInfo (
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin (type.Module.Assembly));
169
var di = new DependencyInfo (
DependencyKind
.RootAssembly, assembly);
190
Context.Annotations.Mark (attribute, new DependencyInfo (
DependencyKind
.RootAssembly, assembly));
Linker.Steps\UnsafeAccessorMarker.cs (3)
110
_markStep.MarkMethodVisibleToReflection (targetMethod, new DependencyInfo (
DependencyKind
.UnsafeAccessorTarget, method), new MessageOrigin (method));
134
_markStep.MarkMethodVisibleToReflection (targetMethod, new DependencyInfo (
DependencyKind
.UnsafeAccessorTarget, method), new MessageOrigin (method));
161
_markStep.MarkFieldVisibleToReflection (targetField, new DependencyInfo (
DependencyKind
.UnsafeAccessorTarget, method), new MessageOrigin (method));
Linker\Annotations.cs (3)
160
Debug.Assert (!(reason.Kind ==
DependencyKind
.AlreadyMarked));
174
Debug.Assert (!(reason.Kind ==
DependencyKind
.AlreadyMarked));
495
Mark (method, new DependencyInfo (
DependencyKind
.PreservedMethod, definition), new MessageOrigin (definition));
Linker\DependencyInfo.cs (5)
152
public
DependencyKind
Kind { get; }
154
public DependencyInfo (
DependencyKind
kind, object? source) => (Kind, Source) = (kind, source);
155
public static readonly DependencyInfo Unspecified = new DependencyInfo (
DependencyKind
.Unspecified, null);
156
public static readonly DependencyInfo AlreadyMarked = new DependencyInfo (
DependencyKind
.AlreadyMarked, null);
157
public static readonly DependencyInfo DisablePrivateReflectionRequirement = new DependencyInfo (
DependencyKind
.DisablePrivateReflectionRequirement, null);
Linker\DgmlDependencyRecorder.cs (1)
114
if (reason.Kind ==
DependencyKind
.Unspecified)
Linker\MarkingHelpers.cs (1)
44
MarkExportedType (exportedType, assembly.MainModule, new DependencyInfo (
DependencyKind
.ExportedType, typeReference), origin);
Linker\SerializationMarker.cs (12)
83
static
DependencyKind
ToDependencyKind (SerializerKind serializerKind) => serializerKind switch {
84
SerializerKind.DataContractSerializer =>
DependencyKind
.DataContractSerialized,
85
SerializerKind.XmlSerializer =>
DependencyKind
.XmlSerialized,
178
MarkRecursiveMembersInternal (argType, new DependencyInfo (
DependencyKind
.GenericArgumentType, typeRef));
181
typeReason = new DependencyInfo (
DependencyKind
.ElementType, typeRef);
199
MarkRecursiveMembersInternal (type.BaseType, new DependencyInfo (
DependencyKind
.SerializedRecursiveType, type));
207
MarkRecursiveMembersInternal (field.FieldType, new DependencyInfo (
DependencyKind
.SerializedRecursiveType, type));
208
_context.Annotations.Mark (field, new DependencyInfo (
DependencyKind
.SerializedMember, type), new MessageOrigin (type));
221
MarkRecursiveMembersInternal (property.PropertyType, new DependencyInfo (
DependencyKind
.SerializedRecursiveType, type));
223
_context.Annotations.Mark (get, new DependencyInfo (
DependencyKind
.SerializedMember, type), new MessageOrigin (type));
225
_context.Annotations.Mark (set, new DependencyInfo (
DependencyKind
.SerializedMember, type), new MessageOrigin (type));
236
_context.Annotations.Mark (method, new DependencyInfo (
DependencyKind
.SerializedMember, type), new MessageOrigin (type));
Linker\XmlDependencyRecorder.cs (1)
100
if (reason.Kind ==
DependencyKind
.Unspecified)