392 references to DependencyKind
illink (392)
Linker.Dataflow\DynamicallyAccessedMembersTypeHierarchy.cs (3)
237
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers(origin, baseType, annotationToApplyToBase,
DependencyKind
.DynamicallyAccessedMemberOnType, declaredOnly: false);
261
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers(origin, interfaceType, annotationToApplyToInterfaces,
DependencyKind
.DynamicallyAccessedMemberOnType, declaredOnly: false);
269
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers(origin, type, annotation,
DependencyKind
.DynamicallyAccessedMemberOnType, declaredOnly: true);
Linker.Dataflow\GenericArgumentDataFlow.cs (1)
60
reflectionMarker.MarkTypeForDynamicallyAccessedMembers(diagnosticContext.Origin, genericArgument, DynamicallyAccessedMemberTypes.PublicParameterlessConstructor,
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument);
Linker.Dataflow\ReflectionMarker.cs (16)
27
internal void MarkTypeForDynamicallyAccessedMembers(in MessageOrigin origin, TypeReference type, DynamicallyAccessedMemberTypes requiredMemberTypes,
DependencyKind
dependencyKind, bool declaredOnly = false)
101
_markStep.MarkTypeVisibleToReflection(typeReference, new DependencyInfo(
DependencyKind
.AccessedViaReflection, origin.Provider), origin);
104
Context.MarkingHelpers.MarkMatchingExportedType(typeResolutionRecord.ResolvedType, typeResolutionRecord.ReferringAssembly, new DependencyInfo(
DependencyKind
.DynamicallyAccessedMember, typeReference), origin);
109
internal void MarkType(in MessageOrigin origin, TypeReference typeRef,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
120
internal void MarkMethod(in MessageOrigin origin, MethodReference methodRef,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
131
void MarkField(in MessageOrigin origin, FieldDefinition field,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
139
internal void MarkProperty(in MessageOrigin origin, PropertyDefinition property,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
147
void MarkEvent(in MessageOrigin origin, EventDefinition @event,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
155
void MarkInterfaceImplementation(in MessageOrigin origin, InterfaceImplementation interfaceImplementation,
DependencyKind
dependencyKind =
DependencyKind
.AccessedViaReflection)
219
_markStep.MarkStaticConstructorVisibleToReflection(type, new DependencyInfo(
DependencyKind
.AccessedViaReflection, origin.Provider), origin);
Linker.Dataflow\RequireDynamicallyAccessedMembersAction.cs (1)
47
_reflectionMarker.MarkTypeForDynamicallyAccessedMembers(_diagnosticContext.Origin, type.Type, dynamicallyAccessedMemberTypes,
DependencyKind
.DynamicallyAccessedMember);
Linker.Steps\DescriptorMarker.cs (8)
63
_context.MarkingHelpers.MarkExportedType(exportedType, assembly.MainModule, new DependencyInfo(
DependencyKind
.XmlDescriptor, assembly.MainModule), GetMessageOriginForPosition(nav));
99
_context.Annotations.Mark(type, new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
111
_context.MarkingHelpers.MarkExportedType(exported, assembly.MainModule, new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
121
_context.MarkingHelpers.MarkExportedType(currentType, assembly.MainModule, new DependencyInfo(
DependencyKind
.DeclaringType, currentType), GetMessageOriginForPosition(nav));
165
_context.Annotations.Mark(type, new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
173
_context.Annotations.Mark(parent, new DependencyInfo(
DependencyKind
.DeclaringType, currentType), GetMessageOriginForPosition(nav));
195
var reason = new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation);
215
var reason = new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation);
Linker.Steps\DiscoverCustomOperatorsHandler.cs (1)
90
Context.Annotations.Mark(method, new DependencyInfo(
DependencyKind
.PreservedOperator, method.DeclaringType), new MessageOrigin(method.DeclaringType));
Linker.Steps\MarkExportedTypesTargetStep.cs (1)
37
context.Annotations.Mark(type, new DependencyInfo(
DependencyKind
.ExportedType, exportedType), new MessageOrigin(assembly));
Linker.Steps\MarkStep.cs (319)
104
static readonly
DependencyKind
[] _entireTypeReasons = new
DependencyKind
[] {
105
DependencyKind
.AccessedViaReflection,
106
DependencyKind
.BaseType,
107
DependencyKind
.PreservedDependency,
108
DependencyKind
.NestedType,
109
DependencyKind
.TypeInAssembly,
110
DependencyKind
.Unspecified,
113
static readonly
DependencyKind
[] _fieldReasons = new
DependencyKind
[] {
114
DependencyKind
.Unspecified,
115
DependencyKind
.AccessedViaReflection,
116
DependencyKind
.AlreadyMarked,
117
DependencyKind
.Custom,
118
DependencyKind
.CustomAttributeField,
119
DependencyKind
.DynamicallyAccessedMember,
120
DependencyKind
.DynamicallyAccessedMemberOnType,
121
DependencyKind
.EventSourceProviderField,
122
DependencyKind
.FieldAccess,
123
DependencyKind
.FieldOnGenericInstance,
124
DependencyKind
.InteropMethodDependency,
125
DependencyKind
.Ldtoken,
126
DependencyKind
.MemberOfType,
127
DependencyKind
.DynamicDependency,
128
DependencyKind
.ReferencedBySpecialAttribute,
129
DependencyKind
.TypePreserve,
130
DependencyKind
.XmlDescriptor,
131
DependencyKind
.UnsafeAccessorTarget,
134
static readonly
DependencyKind
[] _typeReasons = new
DependencyKind
[] {
135
DependencyKind
.Unspecified,
136
DependencyKind
.AccessedViaReflection,
137
DependencyKind
.AlreadyMarked,
138
DependencyKind
.AttributeType,
139
DependencyKind
.BaseType,
140
DependencyKind
.CatchType,
141
DependencyKind
.Custom,
142
DependencyKind
.CustomAttributeArgumentType,
143
DependencyKind
.CustomAttributeArgumentValue,
144
DependencyKind
.DeclaringType,
145
DependencyKind
.DeclaringTypeOfCalledMethod,
146
DependencyKind
.DynamicallyAccessedMember,
147
DependencyKind
.DynamicallyAccessedMemberOnType,
148
DependencyKind
.DynamicDependency,
149
DependencyKind
.ElementType,
150
DependencyKind
.FieldType,
151
DependencyKind
.GenericArgumentType,
152
DependencyKind
.GenericParameterConstraintType,
153
DependencyKind
.InterfaceImplementationInterfaceType,
154
DependencyKind
.Ldtoken,
155
DependencyKind
.ModifierType,
156
DependencyKind
.NestedType,
157
DependencyKind
.InstructionTypeRef,
158
DependencyKind
.ParameterType,
159
DependencyKind
.ReferencedBySpecialAttribute,
160
DependencyKind
.ReturnType,
161
DependencyKind
.TypeInAssembly,
162
DependencyKind
.UnreachableBodyRequirement,
163
DependencyKind
.VariableType,
164
DependencyKind
.ParameterMarshalSpec,
165
DependencyKind
.FieldMarshalSpec,
166
DependencyKind
.ReturnTypeMarshalSpec,
167
DependencyKind
.DynamicInterfaceCastableImplementation,
168
DependencyKind
.XmlDescriptor,
169
DependencyKind
.DisablePrivateReflectionRequirement,
172
static readonly
DependencyKind
[] _methodReasons = new
DependencyKind
[] {
173
DependencyKind
.Unspecified,
174
DependencyKind
.AccessedViaReflection,
175
DependencyKind
.AlreadyMarked,
176
DependencyKind
.AttributeConstructor,
177
DependencyKind
.AttributeProperty,
178
DependencyKind
.BaseDefaultCtorForStubbedMethod,
179
DependencyKind
.BaseMethod,
180
DependencyKind
.CctorForType,
181
DependencyKind
.CctorForField,
182
DependencyKind
.Custom,
183
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument,
184
DependencyKind
.DirectCall,
185
DependencyKind
.DynamicallyAccessedMember,
186
DependencyKind
.DynamicallyAccessedMemberOnType,
187
DependencyKind
.DynamicDependency,
188
DependencyKind
.ElementMethod,
189
DependencyKind
.EventMethod,
190
DependencyKind
.EventOfEventMethod,
191
DependencyKind
.InteropMethodDependency,
192
DependencyKind
.KeptForSpecialAttribute,
193
DependencyKind
.Ldftn,
194
DependencyKind
.Ldtoken,
195
DependencyKind
.Ldvirtftn,
196
DependencyKind
.MemberOfType,
197
DependencyKind
.MethodForInstantiatedType,
198
DependencyKind
.MethodForSpecialType,
199
DependencyKind
.MethodImplOverride,
200
DependencyKind
.MethodOnGenericInstance,
201
DependencyKind
.Newobj,
202
DependencyKind
.Override,
203
DependencyKind
.OverrideOnInstantiatedType,
204
DependencyKind
.DynamicDependency,
205
DependencyKind
.PreservedMethod,
206
DependencyKind
.ReferencedBySpecialAttribute,
207
DependencyKind
.SerializationMethodForType,
208
DependencyKind
.TriggersCctorForCalledMethod,
209
DependencyKind
.TriggersCctorThroughFieldAccess,
210
DependencyKind
.TypePreserve,
211
DependencyKind
.UnreachableBodyRequirement,
212
DependencyKind
.VirtualCall,
213
DependencyKind
.VirtualNeededDueToPreservedScope,
214
DependencyKind
.ParameterMarshalSpec,
215
DependencyKind
.FieldMarshalSpec,
216
DependencyKind
.ReturnTypeMarshalSpec,
217
DependencyKind
.XmlDescriptor,
218
DependencyKind
.UnsafeAccessorTarget,
219
DependencyKind
.DisablePrivateReflectionRequirement,
353
MarkEntireType(nested, new DependencyInfo(
DependencyKind
.NestedType, type), origin);
366
MarkFieldsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
367
MarkMethodsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
373
MarkPropertyVisibleToReflection(property, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
381
MarkEventVisibleToReflection(ev, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
443
MarkAssembly(assembly, new DependencyInfo(
DependencyKind
.AssemblyAction, null), emptyOrigin);
675
MarkType(type, new DependencyInfo(
DependencyKind
.DynamicInterfaceCastableImplementation, iface.InterfaceType), new MessageOrigin(Context.TryResolve(iface.InterfaceType)));
718
MarkMethod(dimInfo.Override, new DependencyInfo(
DependencyKind
.Override, dimInfo.Base), origin);
728
MarkMethod(ov.Override, new DependencyInfo(
DependencyKind
.Override, ov.Base), origin);
773
MarkMethod(overrideInformation.Override, new DependencyInfo(
DependencyKind
.OverrideOnInstantiatedType, overrideInformation.Override.DeclaringType), origin);
779
MarkMethod(overrideInformation.Override, new DependencyInfo(
DependencyKind
.Override, overrideInformation.Base), origin);
980
MarkingHelpers.MarkMatchingExportedType(type, assembly, new DependencyInfo(
DependencyKind
.DynamicDependency, type), origin);
1022
MarkMembersVisibleToReflection(members, new DependencyInfo(
DependencyKind
.DynamicDependency, context), origin);
1093
MarkingHelpers.MarkMatchingExportedType(td, assemblyDef, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin);
1121
MarkEntireType(td, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin);
1127
if (MarkDependencyMethod(td, member, signature, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin))
1130
if (MarkNamedField(td, member, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin))
1204
MarkMethod(ca.Constructor, new DependencyInfo(
DependencyKind
.AttributeConstructor, ca), origin);
1331
MarkType(security_type, new DependencyInfo(
DependencyKind
.AttributeType, sa), origin);
1342
MarkCustomAttributeProperty(named_argument, attribute, ca, new DependencyInfo(
DependencyKind
.AttributeProperty, ca), origin);
1388
MarkField(field, new DependencyInfo(
DependencyKind
.CustomAttributeField, ca), origin);
1453
MarkType(et, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1470
MarkType(argument.Type, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1471
MarkType((TypeReference)argument.Value, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentValue, ca), origin);
1476
MarkType(boxed_value.Type, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1532
MarkSecurityDeclarations(assembly, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assembly), assemblyOrigin);
1544
MarkCustomAttributes(assembly, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assembly), origin);
1545
MarkCustomAttributes(module, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, module), origin);
1548
MarkEntireType(type, new DependencyInfo(
DependencyKind
.TypeInAssembly, assembly), origin);
1557
MarkingHelpers.MarkExportedType(exportedType, module, new DependencyInfo(
DependencyKind
.ExportedType, assembly), origin);
1618
MarkType(moduleType, new DependencyInfo(
DependencyKind
.TypeInAssembly, assembly), origin);
1660
MarkCustomAttribute(customAttribute, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assemblyLevelAttribute.Provider), assemblyOrigin);
1731
Debug.Assert(reason.Kind ==
DependencyKind
.FieldAccess || reason.Kind ==
DependencyKind
.Ldtoken);
1734
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
1737
reason = new DependencyInfo(
DependencyKind
.FieldOnGenericInstance, reference);
1750
void ReportWarningsForReflectionAccess(in MessageOrigin origin, MethodDefinition method,
DependencyKind
dependencyKind)
1761
case
DependencyKind
.AttributeProperty:
1768
case
DependencyKind
.Ldftn:
1769
case
DependencyKind
.Ldvirtftn:
1770
case
DependencyKind
.Ldtoken:
1778
case
DependencyKind
.AttributeConstructor:
1809
case
DependencyKind
.AttributeConstructor:
1810
case
DependencyKind
.AttributeProperty:
1871
if (reason.Kind ==
DependencyKind
.AlreadyMarked)
1886
MarkType(field.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, field), origin);
1889
MarkType(field.FieldType, new DependencyInfo(
DependencyKind
.FieldType, field), fieldOrigin);
1890
MarkCustomAttributes(field, new DependencyInfo(
DependencyKind
.CustomAttribute, field), fieldOrigin);
1891
MarkMarshalSpec(field, new DependencyInfo(
DependencyKind
.FieldMarshalSpec, field), fieldOrigin);
1920
DependencyKind
.FieldAccess => new DependencyInfo(
DependencyKind
.TriggersCctorThroughFieldAccess, reason.Source),
1921
_ => new DependencyInfo(
DependencyKind
.CctorForField, field)
1927
void ProcessAnalysisAnnotationsForField(FieldDefinition field,
DependencyKind
dependencyKind, in MessageOrigin origin)
1932
case
DependencyKind
.AlreadyMarked:
1933
case
DependencyKind
.TypePreserve:
1934
case
DependencyKind
.PreservedMethod:
1935
case
DependencyKind
.MemberOfType:
1938
case
DependencyKind
.DynamicallyAccessedMemberOnType:
1954
case
DependencyKind
.AccessedViaReflection:
1955
case
DependencyKind
.DynamicDependency:
1956
case
DependencyKind
.DynamicallyAccessedMember:
1957
case
DependencyKind
.InteropMethodDependency:
1958
case
DependencyKind
.Ldtoken:
1959
case
DependencyKind
.UnsafeAccessorTarget:
1978
if (reason.Kind ==
DependencyKind
.AlreadyMarked)
1988
MarkAssembly(module.Assembly, new DependencyInfo(
DependencyKind
.AssemblyOfModule, module), origin);
2001
MarkDefaultConstructor(type, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
2002
MarkMethodsIf(type.Methods, IsSpecialSerializationConstructor, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
2005
MarkMethodsIf(type.Methods, HasOnSerializeOrDeserializeAttribute, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
2039
MarkTypeVisibleToReflection(methodDefinition.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, methodDefinition), origin);
2077
MarkTypeVisibleToReflection(fieldDefinition.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, fieldDefinition), origin);
2170
case
DependencyKind
.AlreadyMarked:
2179
if (type.HasMethods && ShouldMarkTypeStaticConstructor(type) && reason.Kind ==
DependencyKind
.DeclaringTypeOfCalledMethod)
2180
MarkStaticConstructor(type, new DependencyInfo(
DependencyKind
.TriggersCctorForCalledMethod, reason.Source), origin);
2190
reason.Kind is not
DependencyKind
.TypeInAssembly)
2202
MarkModule(module, new DependencyInfo(
DependencyKind
.ScopeOfType, type), origin);
2209
MarkType(type.BaseType, new DependencyInfo(
DependencyKind
.BaseType, type), typeOrigin);
2217
MarkType(type.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, type), typeOrigin);
2218
MarkCustomAttributes(type, new DependencyInfo(
DependencyKind
.CustomAttribute, type), typeOrigin);
2219
MarkSecurityDeclarations(type, new DependencyInfo(
DependencyKind
.CustomAttribute, type), typeOrigin);
2227
MarkMethodIf(type.Methods, static m => m.Name == "Finalize", new DependencyInfo(
DependencyKind
.MethodForSpecialType, type), typeOrigin);
2288
MarkMethod(method, new DependencyInfo(
DependencyKind
.VirtualNeededDueToPreservedScope, type), typeOrigin);
2291
if (ShouldMarkTypeStaticConstructor(type) && reason.Kind !=
DependencyKind
.TriggersCctorForCalledMethod)
2293
MarkStaticConstructor(type, new DependencyInfo(
DependencyKind
.CctorForType, type), typeOrigin);
2387
if (MarkMethodsIf(type.Methods, MethodDefinitionExtensions.IsPublicInstancePropertyMethod, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, type), origin))
2388
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2414
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2415
MarkNamedMethod(type, name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2431
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2478
MarkMethodVisibleToReflection(method, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2487
MarkFieldVisibleToReflection(field, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2494
MarkPropertyVisibleToReflection(property, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2503
MarkMethodsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.KeptForSpecialAttribute, attribute), origin);
2504
MarkFieldsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2532
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2533
MarkType(proxyTypeReference, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2537
MarkMethodsVisibleToReflection(proxyType, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2538
MarkFieldsVisibleToReflection(proxyType, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2578
MarkNamedField(method.DeclaringType, member_name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2579
MarkNamedProperty(method.DeclaringType, member_name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2663
MarkCustomAttributes(parameter, new DependencyInfo(
DependencyKind
.GenericParameterCustomAttribute, parameter.Owner), origin);
2669
MarkCustomAttributes(constraint, new DependencyInfo(
DependencyKind
.GenericParameterConstraintCustomAttribute, parameter.Owner), origin);
2670
MarkType(constraint.ConstraintType, new DependencyInfo(
DependencyKind
.GenericParameterConstraintType, parameter.Owner), origin);
2915
MarkStaticFields(nestedType, new DependencyInfo(
DependencyKind
.EventSourceProviderField, td), origin);
2921
MarkMethodsIf(type.Methods, m => m.Name == ".ctor" || m.Name == "Invoke", new DependencyInfo(
DependencyKind
.MethodForSpecialType, type), origin);
2940
MarkType(fnptr.ReturnType, new DependencyInfo(
DependencyKind
.ReturnType, fnptr), origin);
2947
(type, reason) = (specification.ElementType, new DependencyInfo(
DependencyKind
.ElementType, specification));
2960
MarkType(fnptr.Parameters[i].ParameterType, new DependencyInfo(
DependencyKind
.ParameterType, fnptr), origin);
2966
MarkType(mod.ModifierType, new DependencyInfo(
DependencyKind
.ModifierType, mod), origin);
2977
var argumentTypeDef = MarkType(argument, new DependencyInfo(
DependencyKind
.GenericArgumentType, instance), origin);
3005
var di = new DependencyInfo(
DependencyKind
.TypePreserve, type);
3027
var di = new DependencyInfo(
DependencyKind
.TypePreserve, type);
3103
MarkMethodCollection(list, new DependencyInfo(
DependencyKind
.PreservedMethod, type), origin);
3113
MarkMethodCollection(list, new DependencyInfo(
DependencyKind
.PreservedMethod, method), origin);
3183
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
3196
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
3198
reason = new DependencyInfo(
DependencyKind
.MethodOnGenericInstance, reference);
3215
case
DependencyKind
.AlreadyMarked:
3224
reason.Kind ==
DependencyKind
.DirectCall ||
3225
reason.Kind ==
DependencyKind
.VirtualCall ||
3226
reason.Kind ==
DependencyKind
.Newobj;
3234
MarkType(method.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringTypeOfCalledMethod, method), new MessageOrigin(reason.Source as IMemberDefinition ?? method));
3238
&& reason.Kind !=
DependencyKind
.EventMethod)
3240
var
kind = PropagateDependencyKindToAccessors(reason.Kind,
DependencyKind
.EventOfEventMethod);
3267
void ProcessAnalysisAnnotationsForMethod(MethodDefinition method,
DependencyKind
dependencyKind, in MessageOrigin origin)
3276
case
DependencyKind
.DirectCall:
3277
case
DependencyKind
.VirtualCall:
3278
case
DependencyKind
.Newobj:
3281
case
DependencyKind
.MethodForSpecialType:
3284
case
DependencyKind
.AlreadyMarked:
3285
case
DependencyKind
.TypePreserve:
3286
case
DependencyKind
.PreservedMethod:
3293
case
DependencyKind
.BaseMethod:
3294
case
DependencyKind
.MethodImplOverride:
3295
case
DependencyKind
.Override:
3296
case
DependencyKind
.OverrideOnInstantiatedType:
3302
case
DependencyKind
.MethodForInstantiatedType:
3303
case
DependencyKind
.VirtualNeededDueToPreservedScope:
3311
case
DependencyKind
.MemberOfType:
3312
case
DependencyKind
.EventMethod:
3316
case
DependencyKind
.CctorForType:
3317
case
DependencyKind
.CctorForField:
3318
case
DependencyKind
.TriggersCctorThroughFieldAccess:
3319
case
DependencyKind
.TriggersCctorForCalledMethod:
3322
case
DependencyKind
.UnreachableBodyRequirement:
3324
case
DependencyKind
.Custom:
3325
case
DependencyKind
.Unspecified:
3329
case
DependencyKind
.KeptForSpecialAttribute:
3332
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3364
(method, reason) = (specification.ElementMethod, new DependencyInfo(
DependencyKind
.ElementMethod, specification));
3380
reason.Kind ==
DependencyKind
.DirectCall ||
3381
reason.Kind ==
DependencyKind
.VirtualCall ||
3382
reason.Kind ==
DependencyKind
.Newobj;
3388
MarkType(method.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, method), methodOrigin);
3389
MarkCustomAttributes(method, new DependencyInfo(
DependencyKind
.CustomAttribute, method), methodOrigin);
3390
MarkSecurityDeclarations(method, new DependencyInfo(
DependencyKind
.CustomAttribute, method), methodOrigin);
3397
Tracer.AddDirectDependency(method.DeclaringType, new DependencyInfo(
DependencyKind
.InstantiatedByCtor, method), marked: false);
3410
MarkProperty(property, new DependencyInfo(PropagateDependencyKindToAccessors(reason.Kind,
DependencyKind
.PropertyOfPropertyMethod), method));
3417
MarkType(pd.ParameterType, new DependencyInfo(
DependencyKind
.ParameterType, method), methodOrigin);
3418
MarkCustomAttributes(pd, new DependencyInfo(
DependencyKind
.ParameterAttribute, method), methodOrigin);
3419
MarkMarshalSpec(pd, new DependencyInfo(
DependencyKind
.ParameterMarshalSpec, method), methodOrigin);
3442
MarkMethod(@base, new DependencyInfo(
DependencyKind
.MethodImplOverride, method), methodOrigin);
3465
MarkType(method.ReturnType, new DependencyInfo(
DependencyKind
.ReturnType, method), methodOrigin);
3466
MarkCustomAttributes(method.MethodReturnType, new DependencyInfo(
DependencyKind
.ReturnTypeAttribute, method), methodOrigin);
3467
MarkMarshalSpec(method.MethodReturnType, new DependencyInfo(
DependencyKind
.ReturnTypeMarshalSpec, method), methodOrigin);
3493
MarkMethodIf(declaringType.Methods, m => m.Name == methodPair, new DependencyInfo(
DependencyKind
.MethodForSpecialType, declaringType), methodOrigin);
3507
static
DependencyKind
PropagateDependencyKindToAccessors(
DependencyKind
parentDependencyKind,
DependencyKind
kind)
3512
case
DependencyKind
.AlreadyMarked:
3513
case
DependencyKind
.TypePreserve:
3514
case
DependencyKind
.PreservedMethod:
3515
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3530
MarkFields(type, includeStatic: type.IsEnum, reason: new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
3603
if (!MarkDefaultConstructor(baseType, new DependencyInfo(
DependencyKind
.BaseDefaultCtorForStubbedMethod, method), origin))
3609
MarkAndCacheConvertToThrowExceptionCtor(new DependencyInfo(
DependencyKind
.UnreachableBodyRequirement, method), origin);
3652
var ctor = MarkMethodIf(disablePrivateReflection.Methods, MethodDefinitionExtensions.IsDefaultConstructor, new DependencyInfo(
DependencyKind
.DisablePrivateReflectionRequirement, disablePrivateReflection), emptyOrigin);
3677
MarkMethod(ov.Base, new DependencyInfo(
DependencyKind
.BaseMethod, method), origin);
3687
Annotations.MarkProcessed(pii.Module, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method));
3707
MarkDefaultConstructor(returnTypeDefinition, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3708
MarkFields(returnTypeDefinition, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3715
MarkFields(method.DeclaringType, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3732
MarkFields(paramTypeDefinition, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3735
MarkDefaultConstructor(paramTypeDefinition, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3785
MarkCustomAttributes(prop, new DependencyInfo(
DependencyKind
.CustomAttribute, prop), propertyOrigin);
3792
DependencyKind
dependencyKind =
DependencyKind
.EventMethod;
3802
MarkCustomAttributes(evt, new DependencyInfo(
DependencyKind
.CustomAttribute, evt), eventOrigin);
3820
MarkAndCacheConvertToThrowExceptionCtor(new DependencyInfo(
DependencyKind
.UnreachableBodyRequirement, body.Method), origin);
3912
MarkType(var.VariableType, new DependencyInfo(
DependencyKind
.VariableType, methodIL.Method), origin);
3916
MarkType(eh.CatchType, new DependencyInfo(
DependencyKind
.CatchType, methodIL.Method), origin);
3996
MarkField((FieldReference)instruction.Operand, new DependencyInfo(
DependencyKind
.FieldAccess, method), origin);
4001
(
DependencyKind
dependencyKind, bool markForReflectionAccess) = instruction.OpCode.Code switch
4003
Code.Jmp => (
DependencyKind
.DirectCall, false),
4004
Code.Call => (
DependencyKind
.DirectCall, false),
4005
Code.Callvirt => (
DependencyKind
.VirtualCall, false),
4006
Code.Newobj => (
DependencyKind
.Newobj, false),
4007
Code.Ldvirtftn => (
DependencyKind
.Ldvirtftn, true),
4008
Code.Ldftn => (
DependencyKind
.Ldftn, true),
4033
var reason = new DependencyInfo(
DependencyKind
.Ldtoken, method);
4093
MarkType(operand, new DependencyInfo(
DependencyKind
.InstructionTypeRef, method), origin);
4110
Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(
DependencyKind
.InterfaceImplementationOnType, origin.Provider));
4114
MarkCustomAttributes(iface, new DependencyInfo(
DependencyKind
.CustomAttribute, iface), origin);
4116
MarkType(iface.InterfaceType, reason ?? new DependencyInfo(
DependencyKind
.InterfaceImplementationInterfaceType, iface), origin);
Linker.Steps\ProcessReferencesStep.cs (1)
50
Annotations.Mark(assembly.MainModule, new DependencyInfo(
DependencyKind
.AssemblyAction, assembly), new MessageOrigin(assembly));
Linker.Steps\ReflectionBlockedStep.cs (1)
83
Annotations.Mark(ca, new DependencyInfo(
DependencyKind
.DisablePrivateReflection, ca));
Linker.Steps\RootAssemblyInputStep.cs (5)
26
var di = new DependencyInfo(
DependencyKind
.RootAssembly, assembly);
139
Annotations.Mark(type, new DependencyInfo(
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin(type.Module.Assembly));
156
Annotations.Mark(type, new DependencyInfo(
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin(type.Module.Assembly));
170
var di = new DependencyInfo(
DependencyKind
.RootAssembly, assembly);
193
Context.Annotations.Mark(attribute, new DependencyInfo(
DependencyKind
.RootAssembly, assembly));
Linker.Steps\UnsafeAccessorMarker.cs (5)
97
_context.MarkingHelpers.MarkMatchingExportedType(typeResolutionRecord.ResolvedType, typeResolutionRecord.ReferringAssembly, new DependencyInfo(
DependencyKind
.AccessedViaReflection, method), new MessageOrigin(method));
114
_context.MarkingHelpers.MarkMatchingExportedType(typeResolutionRecord.ResolvedType, typeResolutionRecord.ReferringAssembly, new DependencyInfo(
DependencyKind
.AccessedViaReflection, method), new MessageOrigin(method));
164
_markStep.MarkMethodVisibleToReflection(targetMethod, new DependencyInfo(
DependencyKind
.UnsafeAccessorTarget, method), new MessageOrigin(method));
189
_markStep.MarkMethodVisibleToReflection(targetMethod, new DependencyInfo(
DependencyKind
.UnsafeAccessorTarget, method), new MessageOrigin(method));
217
_markStep.MarkFieldVisibleToReflection(targetField, new DependencyInfo(
DependencyKind
.UnsafeAccessorTarget, method), new MessageOrigin(method));
Linker\Annotations.cs (3)
166
Debug.Assert(!(reason.Kind ==
DependencyKind
.AlreadyMarked));
180
Debug.Assert(!(reason.Kind ==
DependencyKind
.AlreadyMarked));
548
Mark(method, new DependencyInfo(
DependencyKind
.PreservedMethod, definition), new MessageOrigin(definition));
Linker\DependencyInfo.cs (5)
155
public
DependencyKind
Kind { get; }
157
public DependencyInfo(
DependencyKind
kind, object? source) => (Kind, Source) = (kind, source);
158
public static readonly DependencyInfo Unspecified = new DependencyInfo(
DependencyKind
.Unspecified, null);
159
public static readonly DependencyInfo AlreadyMarked = new DependencyInfo(
DependencyKind
.AlreadyMarked, null);
160
public static readonly DependencyInfo DisablePrivateReflectionRequirement = new DependencyInfo(
DependencyKind
.DisablePrivateReflectionRequirement, null);
Linker\DgmlDependencyRecorder.cs (1)
118
if (reason.Kind ==
DependencyKind
.Unspecified)
Linker\MarkingHelpers.cs (1)
45
MarkExportedType(exportedType, assembly.MainModule, new DependencyInfo(
DependencyKind
.ExportedType, typeReference), origin);
Linker\SerializationMarker.cs (12)
87
static
DependencyKind
ToDependencyKind(SerializerKind serializerKind) => serializerKind switch
89
SerializerKind.DataContractSerializer =>
DependencyKind
.DataContractSerialized,
90
SerializerKind.XmlSerializer =>
DependencyKind
.XmlSerialized,
188
MarkRecursiveMembersInternal(argType, new DependencyInfo(
DependencyKind
.GenericArgumentType, typeRef));
191
typeReason = new DependencyInfo(
DependencyKind
.ElementType, typeRef);
209
MarkRecursiveMembersInternal(type.BaseType, new DependencyInfo(
DependencyKind
.SerializedRecursiveType, type));
219
MarkRecursiveMembersInternal(field.FieldType, new DependencyInfo(
DependencyKind
.SerializedRecursiveType, type));
220
_context.Annotations.Mark(field, new DependencyInfo(
DependencyKind
.SerializedMember, type), new MessageOrigin(type));
235
MarkRecursiveMembersInternal(property.PropertyType, new DependencyInfo(
DependencyKind
.SerializedRecursiveType, type));
237
_context.Annotations.Mark(get, new DependencyInfo(
DependencyKind
.SerializedMember, type), new MessageOrigin(type));
239
_context.Annotations.Mark(set, new DependencyInfo(
DependencyKind
.SerializedMember, type), new MessageOrigin(type));
252
_context.Annotations.Mark(method, new DependencyInfo(
DependencyKind
.SerializedMember, type), new MessageOrigin(type));
Linker\TypeMapHandler.cs (7)
80
MarkTypeMapAttribute(entry, new DependencyInfo(
DependencyKind
.TypeMapEntry, callingMethod));
100
MarkTypeMapAttribute(entry, new DependencyInfo(
DependencyKind
.TypeMapEntry, callingMethod));
137
MarkTypeMapAttribute(entry, new DependencyInfo(
DependencyKind
.TypeMapAssemblyTarget, callingMethod));
155
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapAssemblyTarget, callingMethod));
179
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapEntry, targetType));
266
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapEntry, null));
286
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapEntry, dependencySource));
Linker\XmlDependencyRecorder.cs (1)
102
if (reason.Kind ==
DependencyKind
.Unspecified)