380 references to DependencyKind
illink (380)
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\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)
43
_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));
157
_context.Annotations.Mark(type, new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
165
_context.Annotations.Mark(parent, new DependencyInfo(
DependencyKind
.DeclaringType, currentType), GetMessageOriginForPosition(nav));
187
_context.Annotations.Mark(field, new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
204
_context.Annotations.Mark(method, new DependencyInfo(
DependencyKind
.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
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 (315)
100
static readonly
DependencyKind
[] _entireTypeReasons = new
DependencyKind
[] {
101
DependencyKind
.AccessedViaReflection,
102
DependencyKind
.BaseType,
103
DependencyKind
.PreservedDependency,
104
DependencyKind
.NestedType,
105
DependencyKind
.TypeInAssembly,
106
DependencyKind
.Unspecified,
109
static readonly
DependencyKind
[] _fieldReasons = new
DependencyKind
[] {
110
DependencyKind
.Unspecified,
111
DependencyKind
.AccessedViaReflection,
112
DependencyKind
.AlreadyMarked,
113
DependencyKind
.Custom,
114
DependencyKind
.CustomAttributeField,
115
DependencyKind
.DynamicallyAccessedMember,
116
DependencyKind
.DynamicallyAccessedMemberOnType,
117
DependencyKind
.EventSourceProviderField,
118
DependencyKind
.FieldAccess,
119
DependencyKind
.FieldOnGenericInstance,
120
DependencyKind
.InteropMethodDependency,
121
DependencyKind
.Ldtoken,
122
DependencyKind
.MemberOfType,
123
DependencyKind
.DynamicDependency,
124
DependencyKind
.ReferencedBySpecialAttribute,
125
DependencyKind
.TypePreserve,
126
DependencyKind
.XmlDescriptor,
127
DependencyKind
.UnsafeAccessorTarget,
130
static readonly
DependencyKind
[] _typeReasons = new
DependencyKind
[] {
131
DependencyKind
.Unspecified,
132
DependencyKind
.AccessedViaReflection,
133
DependencyKind
.AlreadyMarked,
134
DependencyKind
.AttributeType,
135
DependencyKind
.BaseType,
136
DependencyKind
.CatchType,
137
DependencyKind
.Custom,
138
DependencyKind
.CustomAttributeArgumentType,
139
DependencyKind
.CustomAttributeArgumentValue,
140
DependencyKind
.DeclaringType,
141
DependencyKind
.DeclaringTypeOfCalledMethod,
142
DependencyKind
.DynamicallyAccessedMember,
143
DependencyKind
.DynamicallyAccessedMemberOnType,
144
DependencyKind
.DynamicDependency,
145
DependencyKind
.ElementType,
146
DependencyKind
.FieldType,
147
DependencyKind
.GenericArgumentType,
148
DependencyKind
.GenericParameterConstraintType,
149
DependencyKind
.InterfaceImplementationInterfaceType,
150
DependencyKind
.Ldtoken,
151
DependencyKind
.ModifierType,
152
DependencyKind
.NestedType,
153
DependencyKind
.InstructionTypeRef,
154
DependencyKind
.ParameterType,
155
DependencyKind
.ReferencedBySpecialAttribute,
156
DependencyKind
.ReturnType,
157
DependencyKind
.TypeInAssembly,
158
DependencyKind
.UnreachableBodyRequirement,
159
DependencyKind
.VariableType,
160
DependencyKind
.ParameterMarshalSpec,
161
DependencyKind
.FieldMarshalSpec,
162
DependencyKind
.ReturnTypeMarshalSpec,
163
DependencyKind
.DynamicInterfaceCastableImplementation,
164
DependencyKind
.XmlDescriptor,
167
static readonly
DependencyKind
[] _methodReasons = new
DependencyKind
[] {
168
DependencyKind
.Unspecified,
169
DependencyKind
.AccessedViaReflection,
170
DependencyKind
.AlreadyMarked,
171
DependencyKind
.AttributeConstructor,
172
DependencyKind
.AttributeProperty,
173
DependencyKind
.BaseDefaultCtorForStubbedMethod,
174
DependencyKind
.BaseMethod,
175
DependencyKind
.CctorForType,
176
DependencyKind
.CctorForField,
177
DependencyKind
.Custom,
178
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument,
179
DependencyKind
.DirectCall,
180
DependencyKind
.DynamicallyAccessedMember,
181
DependencyKind
.DynamicallyAccessedMemberOnType,
182
DependencyKind
.DynamicDependency,
183
DependencyKind
.ElementMethod,
184
DependencyKind
.EventMethod,
185
DependencyKind
.EventOfEventMethod,
186
DependencyKind
.InteropMethodDependency,
187
DependencyKind
.KeptForSpecialAttribute,
188
DependencyKind
.Ldftn,
189
DependencyKind
.Ldtoken,
190
DependencyKind
.Ldvirtftn,
191
DependencyKind
.MemberOfType,
192
DependencyKind
.MethodForInstantiatedType,
193
DependencyKind
.MethodForSpecialType,
194
DependencyKind
.MethodImplOverride,
195
DependencyKind
.MethodOnGenericInstance,
196
DependencyKind
.Newobj,
197
DependencyKind
.Override,
198
DependencyKind
.OverrideOnInstantiatedType,
199
DependencyKind
.DynamicDependency,
200
DependencyKind
.PreservedMethod,
201
DependencyKind
.ReferencedBySpecialAttribute,
202
DependencyKind
.SerializationMethodForType,
203
DependencyKind
.TriggersCctorForCalledMethod,
204
DependencyKind
.TriggersCctorThroughFieldAccess,
205
DependencyKind
.TypePreserve,
206
DependencyKind
.UnreachableBodyRequirement,
207
DependencyKind
.VirtualCall,
208
DependencyKind
.VirtualNeededDueToPreservedScope,
209
DependencyKind
.ParameterMarshalSpec,
210
DependencyKind
.FieldMarshalSpec,
211
DependencyKind
.ReturnTypeMarshalSpec,
212
DependencyKind
.XmlDescriptor,
213
DependencyKind
.UnsafeAccessorTarget,
335
MarkEntireType(nested, new DependencyInfo(
DependencyKind
.NestedType, type), origin);
348
MarkFieldsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
349
MarkMethodsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
355
MarkPropertyVisibleToReflection(property, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
363
MarkEventVisibleToReflection(ev, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
425
MarkAssembly(assembly, new DependencyInfo(
DependencyKind
.AssemblyAction, null), emptyOrigin);
639
MarkType(type, new DependencyInfo(
DependencyKind
.DynamicInterfaceCastableImplementation, iface.InterfaceType), new MessageOrigin(Context.TryResolve(iface.InterfaceType)));
682
MarkMethod(dimInfo.Override, new DependencyInfo(
DependencyKind
.Override, dimInfo.Base), origin);
692
MarkMethod(ov.Override, new DependencyInfo(
DependencyKind
.Override, ov.Base), origin);
737
MarkMethod(overrideInformation.Override, new DependencyInfo(
DependencyKind
.OverrideOnInstantiatedType, overrideInformation.Override.DeclaringType), origin);
743
MarkMethod(overrideInformation.Override, new DependencyInfo(
DependencyKind
.Override, overrideInformation.Base), origin);
944
MarkingHelpers.MarkMatchingExportedType(type, assembly, new DependencyInfo(
DependencyKind
.DynamicDependency, type), origin);
986
MarkMembersVisibleToReflection(members, new DependencyInfo(
DependencyKind
.DynamicDependency, context), origin);
1057
MarkingHelpers.MarkMatchingExportedType(td, assemblyDef, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin);
1085
MarkEntireType(td, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin);
1091
if (MarkDependencyMethod(td, member, signature, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin))
1094
if (MarkNamedField(td, member, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin))
1168
MarkMethod(ca.Constructor, new DependencyInfo(
DependencyKind
.AttributeConstructor, ca), origin);
1292
MarkType(security_type, new DependencyInfo(
DependencyKind
.AttributeType, sa), origin);
1303
MarkCustomAttributeProperty(named_argument, attribute, ca, new DependencyInfo(
DependencyKind
.AttributeProperty, ca), origin);
1349
MarkField(field, new DependencyInfo(
DependencyKind
.CustomAttributeField, ca), origin);
1414
MarkType(et, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1431
MarkType(argument.Type, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1432
MarkType((TypeReference)argument.Value, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentValue, ca), origin);
1437
MarkType(boxed_value.Type, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1488
MarkSecurityDeclarations(assembly, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assembly), assemblyOrigin);
1500
MarkCustomAttributes(assembly, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assembly), origin);
1501
MarkCustomAttributes(module, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, module), origin);
1504
MarkEntireType(type, new DependencyInfo(
DependencyKind
.TypeInAssembly, assembly), origin);
1533
markingHelpers.MarkExportedType(exportedType, assembly.MainModule, new DependencyInfo(
DependencyKind
.ExportedType, assembly), new MessageOrigin(assembly));
1569
MarkType(moduleType, new DependencyInfo(
DependencyKind
.TypeInAssembly, assembly), origin);
1611
MarkCustomAttribute(customAttribute, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assemblyLevelAttribute.Provider), assemblyOrigin);
1682
Debug.Assert(reason.Kind ==
DependencyKind
.FieldAccess || reason.Kind ==
DependencyKind
.Ldtoken);
1685
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
1688
reason = new DependencyInfo(
DependencyKind
.FieldOnGenericInstance, reference);
1701
void ReportWarningsForReflectionAccess(in MessageOrigin origin, MethodDefinition method,
DependencyKind
dependencyKind)
1712
case
DependencyKind
.AttributeProperty:
1719
case
DependencyKind
.Ldftn:
1720
case
DependencyKind
.Ldvirtftn:
1721
case
DependencyKind
.Ldtoken:
1748
case
DependencyKind
.AttributeConstructor:
1749
case
DependencyKind
.AttributeProperty:
1810
if (reason.Kind ==
DependencyKind
.AlreadyMarked)
1825
MarkType(field.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, field), origin);
1828
MarkType(field.FieldType, new DependencyInfo(
DependencyKind
.FieldType, field), fieldOrigin);
1829
MarkCustomAttributes(field, new DependencyInfo(
DependencyKind
.CustomAttribute, field), fieldOrigin);
1830
MarkMarshalSpec(field, new DependencyInfo(
DependencyKind
.FieldMarshalSpec, field), fieldOrigin);
1859
DependencyKind
.FieldAccess => new DependencyInfo(
DependencyKind
.TriggersCctorThroughFieldAccess, reason.Source),
1860
_ => new DependencyInfo(
DependencyKind
.CctorForField, field)
1866
void ProcessAnalysisAnnotationsForField(FieldDefinition field,
DependencyKind
dependencyKind, in MessageOrigin origin)
1871
case
DependencyKind
.AlreadyMarked:
1872
case
DependencyKind
.TypePreserve:
1873
case
DependencyKind
.PreservedMethod:
1874
case
DependencyKind
.MemberOfType:
1877
case
DependencyKind
.DynamicallyAccessedMemberOnType:
1893
case
DependencyKind
.AccessedViaReflection:
1894
case
DependencyKind
.DynamicDependency:
1895
case
DependencyKind
.DynamicallyAccessedMember:
1896
case
DependencyKind
.InteropMethodDependency:
1897
case
DependencyKind
.Ldtoken:
1898
case
DependencyKind
.UnsafeAccessorTarget:
1917
if (reason.Kind ==
DependencyKind
.AlreadyMarked)
1927
MarkAssembly(module.Assembly, new DependencyInfo(
DependencyKind
.AssemblyOfModule, module), origin);
1940
MarkDefaultConstructor(type, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
1941
MarkMethodsIf(type.Methods, IsSpecialSerializationConstructor, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
1944
MarkMethodsIf(type.Methods, HasOnSerializeOrDeserializeAttribute, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
2074
case
DependencyKind
.AlreadyMarked:
2083
if (type.HasMethods && ShouldMarkTypeStaticConstructor(type) && reason.Kind ==
DependencyKind
.DeclaringTypeOfCalledMethod)
2084
MarkStaticConstructor(type, new DependencyInfo(
DependencyKind
.TriggersCctorForCalledMethod, reason.Source), origin);
2094
reason.Kind is not
DependencyKind
.TypeInAssembly)
2102
MarkModule(module, new DependencyInfo(
DependencyKind
.ScopeOfType, type), origin);
2109
MarkType(type.BaseType, new DependencyInfo(
DependencyKind
.BaseType, type), typeOrigin);
2117
MarkType(type.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, type), typeOrigin);
2118
MarkCustomAttributes(type, new DependencyInfo(
DependencyKind
.CustomAttribute, type), typeOrigin);
2119
MarkSecurityDeclarations(type, new DependencyInfo(
DependencyKind
.CustomAttribute, type), typeOrigin);
2138
MarkMethodIf(type.Methods, static m => m.Name == "Finalize", new DependencyInfo(
DependencyKind
.MethodForSpecialType, type), typeOrigin);
2199
MarkMethod(method, new DependencyInfo(
DependencyKind
.VirtualNeededDueToPreservedScope, type), typeOrigin);
2202
if (ShouldMarkTypeStaticConstructor(type) && reason.Kind !=
DependencyKind
.TriggersCctorForCalledMethod)
2204
MarkStaticConstructor(type, new DependencyInfo(
DependencyKind
.CctorForType, type), typeOrigin);
2298
if (MarkMethodsIf(type.Methods, MethodDefinitionExtensions.IsPublicInstancePropertyMethod, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, type), origin))
2299
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2325
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2326
MarkNamedMethod(type, name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2342
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2389
MarkMethodVisibleToReflection(method, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2398
MarkFieldVisibleToReflection(field, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2405
MarkPropertyVisibleToReflection(property, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2414
MarkMethodsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.KeptForSpecialAttribute, attribute), origin);
2415
MarkFieldsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2443
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2444
MarkType(proxyTypeReference, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2448
MarkMethodsVisibleToReflection(proxyType, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2449
MarkFieldsVisibleToReflection(proxyType, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2489
MarkNamedField(method.DeclaringType, member_name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2490
MarkNamedProperty(method.DeclaringType, member_name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2574
MarkCustomAttributes(parameter, new DependencyInfo(
DependencyKind
.GenericParameterCustomAttribute, parameter.Owner), origin);
2580
MarkCustomAttributes(constraint, new DependencyInfo(
DependencyKind
.GenericParameterConstraintCustomAttribute, parameter.Owner), origin);
2581
MarkType(constraint.ConstraintType, new DependencyInfo(
DependencyKind
.GenericParameterConstraintType, parameter.Owner), origin);
2826
MarkStaticFields(nestedType, new DependencyInfo(
DependencyKind
.EventSourceProviderField, td), origin);
2832
MarkMethodsIf(type.Methods, m => m.Name == ".ctor" || m.Name == "Invoke", new DependencyInfo(
DependencyKind
.MethodForSpecialType, type), origin);
2851
MarkType(fnptr.ReturnType, new DependencyInfo(
DependencyKind
.ReturnType, fnptr), origin);
2858
(type, reason) = (specification.ElementType, new DependencyInfo(
DependencyKind
.ElementType, specification));
2871
MarkType(fnptr.Parameters[i].ParameterType, new DependencyInfo(
DependencyKind
.ParameterType, fnptr), origin);
2877
MarkType(mod.ModifierType, new DependencyInfo(
DependencyKind
.ModifierType, mod), origin);
2892
var argumentTypeDef = MarkType(argument, new DependencyInfo(
DependencyKind
.GenericArgumentType, instance), origin);
2910
MarkDefaultConstructor(argumentTypeDef, new DependencyInfo(
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument, instance), origin);
2934
var di = new DependencyInfo(
DependencyKind
.TypePreserve, type);
2956
var di = new DependencyInfo(
DependencyKind
.TypePreserve, type);
3032
MarkMethodCollection(list, new DependencyInfo(
DependencyKind
.PreservedMethod, type), origin);
3042
MarkMethodCollection(list, new DependencyInfo(
DependencyKind
.PreservedMethod, method), origin);
3112
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
3125
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
3127
reason = new DependencyInfo(
DependencyKind
.MethodOnGenericInstance, reference);
3155
case
DependencyKind
.AlreadyMarked:
3164
reason.Kind ==
DependencyKind
.DirectCall ||
3165
reason.Kind ==
DependencyKind
.VirtualCall ||
3166
reason.Kind ==
DependencyKind
.Newobj;
3174
MarkType(method.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringTypeOfCalledMethod, method), new MessageOrigin(reason.Source as IMemberDefinition ?? method));
3178
&& reason.Kind !=
DependencyKind
.EventMethod)
3180
var
kind = PropagateDependencyKindToAccessors(reason.Kind,
DependencyKind
.EventOfEventMethod);
3207
void ProcessAnalysisAnnotationsForMethod(MethodDefinition method,
DependencyKind
dependencyKind, in MessageOrigin origin)
3216
case
DependencyKind
.DirectCall:
3217
case
DependencyKind
.VirtualCall:
3218
case
DependencyKind
.Newobj:
3221
case
DependencyKind
.MethodForSpecialType:
3224
case
DependencyKind
.AlreadyMarked:
3225
case
DependencyKind
.TypePreserve:
3226
case
DependencyKind
.PreservedMethod:
3233
case
DependencyKind
.BaseMethod:
3234
case
DependencyKind
.MethodImplOverride:
3235
case
DependencyKind
.Override:
3236
case
DependencyKind
.OverrideOnInstantiatedType:
3242
case
DependencyKind
.MethodForInstantiatedType:
3243
case
DependencyKind
.VirtualNeededDueToPreservedScope:
3251
case
DependencyKind
.MemberOfType:
3252
case
DependencyKind
.EventMethod:
3256
case
DependencyKind
.CctorForType:
3257
case
DependencyKind
.CctorForField:
3258
case
DependencyKind
.TriggersCctorThroughFieldAccess:
3259
case
DependencyKind
.TriggersCctorForCalledMethod:
3262
case
DependencyKind
.UnreachableBodyRequirement:
3264
case
DependencyKind
.Custom:
3265
case
DependencyKind
.Unspecified:
3269
case
DependencyKind
.KeptForSpecialAttribute:
3272
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3304
(method, reason) = (specification.ElementMethod, new DependencyInfo(
DependencyKind
.ElementMethod, specification));
3320
reason.Kind ==
DependencyKind
.DirectCall ||
3321
reason.Kind ==
DependencyKind
.VirtualCall ||
3322
reason.Kind ==
DependencyKind
.Newobj;
3328
MarkType(method.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, method), methodOrigin);
3329
MarkCustomAttributes(method, new DependencyInfo(
DependencyKind
.CustomAttribute, method), methodOrigin);
3330
MarkSecurityDeclarations(method, new DependencyInfo(
DependencyKind
.CustomAttribute, method), methodOrigin);
3337
Tracer.AddDirectDependency(method.DeclaringType, new DependencyInfo(
DependencyKind
.InstantiatedByCtor, method), marked: false);
3350
MarkProperty(property, new DependencyInfo(PropagateDependencyKindToAccessors(reason.Kind,
DependencyKind
.PropertyOfPropertyMethod), method));
3357
MarkType(pd.ParameterType, new DependencyInfo(
DependencyKind
.ParameterType, method), methodOrigin);
3358
MarkCustomAttributes(pd, new DependencyInfo(
DependencyKind
.ParameterAttribute, method), methodOrigin);
3359
MarkMarshalSpec(pd, new DependencyInfo(
DependencyKind
.ParameterMarshalSpec, method), methodOrigin);
3382
MarkMethod(@base, new DependencyInfo(
DependencyKind
.MethodImplOverride, method), methodOrigin);
3405
MarkType(method.ReturnType, new DependencyInfo(
DependencyKind
.ReturnType, method), methodOrigin);
3406
MarkCustomAttributes(method.MethodReturnType, new DependencyInfo(
DependencyKind
.ReturnTypeAttribute, method), methodOrigin);
3407
MarkMarshalSpec(method.MethodReturnType, new DependencyInfo(
DependencyKind
.ReturnTypeMarshalSpec, method), methodOrigin);
3433
MarkMethodIf(declaringType.Methods, m => m.Name == methodPair, new DependencyInfo(
DependencyKind
.MethodForSpecialType, declaringType), methodOrigin);
3447
static
DependencyKind
PropagateDependencyKindToAccessors(
DependencyKind
parentDependencyKind,
DependencyKind
kind)
3452
case
DependencyKind
.AlreadyMarked:
3453
case
DependencyKind
.TypePreserve:
3454
case
DependencyKind
.PreservedMethod:
3455
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3470
MarkFields(type, includeStatic: type.IsEnum, reason: new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
3539
if (!MarkDefaultConstructor(baseType, new DependencyInfo(
DependencyKind
.BaseDefaultCtorForStubbedMethod, method), origin))
3545
MarkAndCacheConvertToThrowExceptionCtor(new DependencyInfo(
DependencyKind
.UnreachableBodyRequirement, method), origin);
3588
var ctor = MarkMethodIf(disablePrivateReflection.Methods, MethodDefinitionExtensions.IsDefaultConstructor, new DependencyInfo(
DependencyKind
.DisablePrivateReflectionRequirement, disablePrivateReflection), emptyOrigin);
3613
MarkMethod(ov.Base, new DependencyInfo(
DependencyKind
.BaseMethod, method), origin);
3623
Annotations.MarkProcessed(pii.Module, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method));
3643
MarkDefaultConstructor(returnTypeDefinition, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3644
MarkFields(returnTypeDefinition, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3651
MarkFields(method.DeclaringType, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3668
MarkFields(paramTypeDefinition, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3671
MarkDefaultConstructor(paramTypeDefinition, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3721
MarkCustomAttributes(prop, new DependencyInfo(
DependencyKind
.CustomAttribute, prop), propertyOrigin);
3728
DependencyKind
dependencyKind =
DependencyKind
.EventMethod;
3738
MarkCustomAttributes(evt, new DependencyInfo(
DependencyKind
.CustomAttribute, evt), eventOrigin);
3756
MarkAndCacheConvertToThrowExceptionCtor(new DependencyInfo(
DependencyKind
.UnreachableBodyRequirement, body.Method), origin);
3825
MarkType(var.VariableType, new DependencyInfo(
DependencyKind
.VariableType, methodIL.Method), origin);
3829
MarkType(eh.CatchType, new DependencyInfo(
DependencyKind
.CatchType, methodIL.Method), origin);
3896
MarkField((FieldReference)instruction.Operand, new DependencyInfo(
DependencyKind
.FieldAccess, method), origin);
3901
(
DependencyKind
dependencyKind, bool markForReflectionAccess) = instruction.OpCode.Code switch
3903
Code.Jmp => (
DependencyKind
.DirectCall, false),
3904
Code.Call => (
DependencyKind
.DirectCall, false),
3905
Code.Callvirt => (
DependencyKind
.VirtualCall, false),
3906
Code.Newobj => (
DependencyKind
.Newobj, false),
3907
Code.Ldvirtftn => (
DependencyKind
.Ldvirtftn, true),
3908
Code.Ldftn => (
DependencyKind
.Ldftn, true),
3933
var reason = new DependencyInfo(
DependencyKind
.Ldtoken, method);
3985
MarkType(operand, new DependencyInfo(
DependencyKind
.InstructionTypeRef, method), origin);
4002
Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(
DependencyKind
.InterfaceImplementationOnType, origin.Provider));
4005
MarkCustomAttributes(iface, new DependencyInfo(
DependencyKind
.CustomAttribute, iface), origin);
4007
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)
27
var di = new DependencyInfo(
DependencyKind
.RootAssembly, assembly);
144
Annotations.Mark(type, new DependencyInfo(
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin(type.Module.Assembly));
161
Annotations.Mark(type, new DependencyInfo(
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin(type.Module.Assembly));
175
var di = new DependencyInfo(
DependencyKind
.RootAssembly, assembly);
198
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)
162
Debug.Assert(!(reason.Kind ==
DependencyKind
.AlreadyMarked));
176
Debug.Assert(!(reason.Kind ==
DependencyKind
.AlreadyMarked));
505
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)
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\XmlDependencyRecorder.cs (1)
102
if (reason.Kind ==
DependencyKind
.Unspecified)