386 references to DependencyKind
illink (386)
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 (316)
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,
171
static readonly
DependencyKind
[] _methodReasons = new
DependencyKind
[] {
172
DependencyKind
.Unspecified,
173
DependencyKind
.AccessedViaReflection,
174
DependencyKind
.AlreadyMarked,
175
DependencyKind
.AttributeConstructor,
176
DependencyKind
.AttributeProperty,
177
DependencyKind
.BaseDefaultCtorForStubbedMethod,
178
DependencyKind
.BaseMethod,
179
DependencyKind
.CctorForType,
180
DependencyKind
.CctorForField,
181
DependencyKind
.Custom,
182
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument,
183
DependencyKind
.DirectCall,
184
DependencyKind
.DynamicallyAccessedMember,
185
DependencyKind
.DynamicallyAccessedMemberOnType,
186
DependencyKind
.DynamicDependency,
187
DependencyKind
.ElementMethod,
188
DependencyKind
.EventMethod,
189
DependencyKind
.EventOfEventMethod,
190
DependencyKind
.InteropMethodDependency,
191
DependencyKind
.KeptForSpecialAttribute,
192
DependencyKind
.Ldftn,
193
DependencyKind
.Ldtoken,
194
DependencyKind
.Ldvirtftn,
195
DependencyKind
.MemberOfType,
196
DependencyKind
.MethodForInstantiatedType,
197
DependencyKind
.MethodForSpecialType,
198
DependencyKind
.MethodImplOverride,
199
DependencyKind
.MethodOnGenericInstance,
200
DependencyKind
.Newobj,
201
DependencyKind
.Override,
202
DependencyKind
.OverrideOnInstantiatedType,
203
DependencyKind
.DynamicDependency,
204
DependencyKind
.PreservedMethod,
205
DependencyKind
.ReferencedBySpecialAttribute,
206
DependencyKind
.SerializationMethodForType,
207
DependencyKind
.TriggersCctorForCalledMethod,
208
DependencyKind
.TriggersCctorThroughFieldAccess,
209
DependencyKind
.TypePreserve,
210
DependencyKind
.UnreachableBodyRequirement,
211
DependencyKind
.VirtualCall,
212
DependencyKind
.VirtualNeededDueToPreservedScope,
213
DependencyKind
.ParameterMarshalSpec,
214
DependencyKind
.FieldMarshalSpec,
215
DependencyKind
.ReturnTypeMarshalSpec,
216
DependencyKind
.XmlDescriptor,
217
DependencyKind
.UnsafeAccessorTarget,
347
MarkEntireType(nested, new DependencyInfo(
DependencyKind
.NestedType, type), origin);
360
MarkFieldsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
361
MarkMethodsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
367
MarkPropertyVisibleToReflection(property, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
375
MarkEventVisibleToReflection(ev, new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
437
MarkAssembly(assembly, new DependencyInfo(
DependencyKind
.AssemblyAction, null), emptyOrigin);
651
MarkType(type, new DependencyInfo(
DependencyKind
.DynamicInterfaceCastableImplementation, iface.InterfaceType), new MessageOrigin(Context.TryResolve(iface.InterfaceType)));
694
MarkMethod(dimInfo.Override, new DependencyInfo(
DependencyKind
.Override, dimInfo.Base), origin);
704
MarkMethod(ov.Override, new DependencyInfo(
DependencyKind
.Override, ov.Base), origin);
749
MarkMethod(overrideInformation.Override, new DependencyInfo(
DependencyKind
.OverrideOnInstantiatedType, overrideInformation.Override.DeclaringType), origin);
755
MarkMethod(overrideInformation.Override, new DependencyInfo(
DependencyKind
.Override, overrideInformation.Base), origin);
956
MarkingHelpers.MarkMatchingExportedType(type, assembly, new DependencyInfo(
DependencyKind
.DynamicDependency, type), origin);
998
MarkMembersVisibleToReflection(members, new DependencyInfo(
DependencyKind
.DynamicDependency, context), origin);
1069
MarkingHelpers.MarkMatchingExportedType(td, assemblyDef, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin);
1097
MarkEntireType(td, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin);
1103
if (MarkDependencyMethod(td, member, signature, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin))
1106
if (MarkNamedField(td, member, new DependencyInfo(
DependencyKind
.PreservedDependency, ca), origin))
1180
MarkMethod(ca.Constructor, new DependencyInfo(
DependencyKind
.AttributeConstructor, ca), origin);
1304
MarkType(security_type, new DependencyInfo(
DependencyKind
.AttributeType, sa), origin);
1315
MarkCustomAttributeProperty(named_argument, attribute, ca, new DependencyInfo(
DependencyKind
.AttributeProperty, ca), origin);
1361
MarkField(field, new DependencyInfo(
DependencyKind
.CustomAttributeField, ca), origin);
1426
MarkType(et, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1443
MarkType(argument.Type, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1444
MarkType((TypeReference)argument.Value, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentValue, ca), origin);
1449
MarkType(boxed_value.Type, new DependencyInfo(
DependencyKind
.CustomAttributeArgumentType, ca), origin);
1500
MarkSecurityDeclarations(assembly, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assembly), assemblyOrigin);
1512
MarkCustomAttributes(assembly, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assembly), origin);
1513
MarkCustomAttributes(module, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, module), origin);
1516
MarkEntireType(type, new DependencyInfo(
DependencyKind
.TypeInAssembly, assembly), origin);
1545
markingHelpers.MarkExportedType(exportedType, assembly.MainModule, new DependencyInfo(
DependencyKind
.ExportedType, assembly), new MessageOrigin(assembly));
1581
MarkType(moduleType, new DependencyInfo(
DependencyKind
.TypeInAssembly, assembly), origin);
1623
MarkCustomAttribute(customAttribute, new DependencyInfo(
DependencyKind
.AssemblyOrModuleAttribute, assemblyLevelAttribute.Provider), assemblyOrigin);
1694
Debug.Assert(reason.Kind ==
DependencyKind
.FieldAccess || reason.Kind ==
DependencyKind
.Ldtoken);
1697
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
1700
reason = new DependencyInfo(
DependencyKind
.FieldOnGenericInstance, reference);
1713
void ReportWarningsForReflectionAccess(in MessageOrigin origin, MethodDefinition method,
DependencyKind
dependencyKind)
1724
case
DependencyKind
.AttributeProperty:
1731
case
DependencyKind
.Ldftn:
1732
case
DependencyKind
.Ldvirtftn:
1733
case
DependencyKind
.Ldtoken:
1741
case
DependencyKind
.AttributeConstructor:
1772
case
DependencyKind
.AttributeConstructor:
1773
case
DependencyKind
.AttributeProperty:
1834
if (reason.Kind ==
DependencyKind
.AlreadyMarked)
1849
MarkType(field.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, field), origin);
1852
MarkType(field.FieldType, new DependencyInfo(
DependencyKind
.FieldType, field), fieldOrigin);
1853
MarkCustomAttributes(field, new DependencyInfo(
DependencyKind
.CustomAttribute, field), fieldOrigin);
1854
MarkMarshalSpec(field, new DependencyInfo(
DependencyKind
.FieldMarshalSpec, field), fieldOrigin);
1883
DependencyKind
.FieldAccess => new DependencyInfo(
DependencyKind
.TriggersCctorThroughFieldAccess, reason.Source),
1884
_ => new DependencyInfo(
DependencyKind
.CctorForField, field)
1890
void ProcessAnalysisAnnotationsForField(FieldDefinition field,
DependencyKind
dependencyKind, in MessageOrigin origin)
1895
case
DependencyKind
.AlreadyMarked:
1896
case
DependencyKind
.TypePreserve:
1897
case
DependencyKind
.PreservedMethod:
1898
case
DependencyKind
.MemberOfType:
1901
case
DependencyKind
.DynamicallyAccessedMemberOnType:
1917
case
DependencyKind
.AccessedViaReflection:
1918
case
DependencyKind
.DynamicDependency:
1919
case
DependencyKind
.DynamicallyAccessedMember:
1920
case
DependencyKind
.InteropMethodDependency:
1921
case
DependencyKind
.Ldtoken:
1922
case
DependencyKind
.UnsafeAccessorTarget:
1941
if (reason.Kind ==
DependencyKind
.AlreadyMarked)
1951
MarkAssembly(module.Assembly, new DependencyInfo(
DependencyKind
.AssemblyOfModule, module), origin);
1964
MarkDefaultConstructor(type, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
1965
MarkMethodsIf(type.Methods, IsSpecialSerializationConstructor, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
1968
MarkMethodsIf(type.Methods, HasOnSerializeOrDeserializeAttribute, new DependencyInfo(
DependencyKind
.SerializationMethodForType, type), origin);
2104
case
DependencyKind
.AlreadyMarked:
2113
if (type.HasMethods && ShouldMarkTypeStaticConstructor(type) && reason.Kind ==
DependencyKind
.DeclaringTypeOfCalledMethod)
2114
MarkStaticConstructor(type, new DependencyInfo(
DependencyKind
.TriggersCctorForCalledMethod, reason.Source), origin);
2124
reason.Kind is not
DependencyKind
.TypeInAssembly)
2136
MarkModule(module, new DependencyInfo(
DependencyKind
.ScopeOfType, type), origin);
2143
MarkType(type.BaseType, new DependencyInfo(
DependencyKind
.BaseType, type), typeOrigin);
2151
MarkType(type.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, type), typeOrigin);
2152
MarkCustomAttributes(type, new DependencyInfo(
DependencyKind
.CustomAttribute, type), typeOrigin);
2153
MarkSecurityDeclarations(type, new DependencyInfo(
DependencyKind
.CustomAttribute, type), typeOrigin);
2172
MarkMethodIf(type.Methods, static m => m.Name == "Finalize", new DependencyInfo(
DependencyKind
.MethodForSpecialType, type), typeOrigin);
2233
MarkMethod(method, new DependencyInfo(
DependencyKind
.VirtualNeededDueToPreservedScope, type), typeOrigin);
2236
if (ShouldMarkTypeStaticConstructor(type) && reason.Kind !=
DependencyKind
.TriggersCctorForCalledMethod)
2238
MarkStaticConstructor(type, new DependencyInfo(
DependencyKind
.CctorForType, type), typeOrigin);
2332
if (MarkMethodsIf(type.Methods, MethodDefinitionExtensions.IsPublicInstancePropertyMethod, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, type), origin))
2333
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2359
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2360
MarkNamedMethod(type, name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2376
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2423
MarkMethodVisibleToReflection(method, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2432
MarkFieldVisibleToReflection(field, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2439
MarkPropertyVisibleToReflection(property, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2448
MarkMethodsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.KeptForSpecialAttribute, attribute), origin);
2449
MarkFieldsVisibleToReflection(type, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2477
Tracer.AddDirectDependency(attribute, new DependencyInfo(
DependencyKind
.CustomAttribute, type), marked: false);
2478
MarkType(proxyTypeReference, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2482
MarkMethodsVisibleToReflection(proxyType, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2483
MarkFieldsVisibleToReflection(proxyType, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2523
MarkNamedField(method.DeclaringType, member_name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2524
MarkNamedProperty(method.DeclaringType, member_name, new DependencyInfo(
DependencyKind
.ReferencedBySpecialAttribute, attribute), origin);
2608
MarkCustomAttributes(parameter, new DependencyInfo(
DependencyKind
.GenericParameterCustomAttribute, parameter.Owner), origin);
2614
MarkCustomAttributes(constraint, new DependencyInfo(
DependencyKind
.GenericParameterConstraintCustomAttribute, parameter.Owner), origin);
2615
MarkType(constraint.ConstraintType, new DependencyInfo(
DependencyKind
.GenericParameterConstraintType, parameter.Owner), origin);
2860
MarkStaticFields(nestedType, new DependencyInfo(
DependencyKind
.EventSourceProviderField, td), origin);
2866
MarkMethodsIf(type.Methods, m => m.Name == ".ctor" || m.Name == "Invoke", new DependencyInfo(
DependencyKind
.MethodForSpecialType, type), origin);
2885
MarkType(fnptr.ReturnType, new DependencyInfo(
DependencyKind
.ReturnType, fnptr), origin);
2892
(type, reason) = (specification.ElementType, new DependencyInfo(
DependencyKind
.ElementType, specification));
2905
MarkType(fnptr.Parameters[i].ParameterType, new DependencyInfo(
DependencyKind
.ParameterType, fnptr), origin);
2911
MarkType(mod.ModifierType, new DependencyInfo(
DependencyKind
.ModifierType, mod), origin);
2926
var argumentTypeDef = MarkType(argument, new DependencyInfo(
DependencyKind
.GenericArgumentType, instance), origin);
2944
MarkDefaultConstructor(argumentTypeDef, new DependencyInfo(
DependencyKind
.DefaultCtorForNewConstrainedGenericArgument, instance), origin);
2968
var di = new DependencyInfo(
DependencyKind
.TypePreserve, type);
2990
var di = new DependencyInfo(
DependencyKind
.TypePreserve, type);
3066
MarkMethodCollection(list, new DependencyInfo(
DependencyKind
.PreservedMethod, type), origin);
3076
MarkMethodCollection(list, new DependencyInfo(
DependencyKind
.PreservedMethod, method), origin);
3146
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
3159
MarkType(reference.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, reference), origin);
3161
reason = new DependencyInfo(
DependencyKind
.MethodOnGenericInstance, reference);
3189
case
DependencyKind
.AlreadyMarked:
3198
reason.Kind ==
DependencyKind
.DirectCall ||
3199
reason.Kind ==
DependencyKind
.VirtualCall ||
3200
reason.Kind ==
DependencyKind
.Newobj;
3208
MarkType(method.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringTypeOfCalledMethod, method), new MessageOrigin(reason.Source as IMemberDefinition ?? method));
3212
&& reason.Kind !=
DependencyKind
.EventMethod)
3214
var
kind = PropagateDependencyKindToAccessors(reason.Kind,
DependencyKind
.EventOfEventMethod);
3241
void ProcessAnalysisAnnotationsForMethod(MethodDefinition method,
DependencyKind
dependencyKind, in MessageOrigin origin)
3250
case
DependencyKind
.DirectCall:
3251
case
DependencyKind
.VirtualCall:
3252
case
DependencyKind
.Newobj:
3255
case
DependencyKind
.MethodForSpecialType:
3258
case
DependencyKind
.AlreadyMarked:
3259
case
DependencyKind
.TypePreserve:
3260
case
DependencyKind
.PreservedMethod:
3267
case
DependencyKind
.BaseMethod:
3268
case
DependencyKind
.MethodImplOverride:
3269
case
DependencyKind
.Override:
3270
case
DependencyKind
.OverrideOnInstantiatedType:
3276
case
DependencyKind
.MethodForInstantiatedType:
3277
case
DependencyKind
.VirtualNeededDueToPreservedScope:
3285
case
DependencyKind
.MemberOfType:
3286
case
DependencyKind
.EventMethod:
3290
case
DependencyKind
.CctorForType:
3291
case
DependencyKind
.CctorForField:
3292
case
DependencyKind
.TriggersCctorThroughFieldAccess:
3293
case
DependencyKind
.TriggersCctorForCalledMethod:
3296
case
DependencyKind
.UnreachableBodyRequirement:
3298
case
DependencyKind
.Custom:
3299
case
DependencyKind
.Unspecified:
3303
case
DependencyKind
.KeptForSpecialAttribute:
3306
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3338
(method, reason) = (specification.ElementMethod, new DependencyInfo(
DependencyKind
.ElementMethod, specification));
3354
reason.Kind ==
DependencyKind
.DirectCall ||
3355
reason.Kind ==
DependencyKind
.VirtualCall ||
3356
reason.Kind ==
DependencyKind
.Newobj;
3362
MarkType(method.DeclaringType, new DependencyInfo(
DependencyKind
.DeclaringType, method), methodOrigin);
3363
MarkCustomAttributes(method, new DependencyInfo(
DependencyKind
.CustomAttribute, method), methodOrigin);
3364
MarkSecurityDeclarations(method, new DependencyInfo(
DependencyKind
.CustomAttribute, method), methodOrigin);
3371
Tracer.AddDirectDependency(method.DeclaringType, new DependencyInfo(
DependencyKind
.InstantiatedByCtor, method), marked: false);
3384
MarkProperty(property, new DependencyInfo(PropagateDependencyKindToAccessors(reason.Kind,
DependencyKind
.PropertyOfPropertyMethod), method));
3391
MarkType(pd.ParameterType, new DependencyInfo(
DependencyKind
.ParameterType, method), methodOrigin);
3392
MarkCustomAttributes(pd, new DependencyInfo(
DependencyKind
.ParameterAttribute, method), methodOrigin);
3393
MarkMarshalSpec(pd, new DependencyInfo(
DependencyKind
.ParameterMarshalSpec, method), methodOrigin);
3416
MarkMethod(@base, new DependencyInfo(
DependencyKind
.MethodImplOverride, method), methodOrigin);
3439
MarkType(method.ReturnType, new DependencyInfo(
DependencyKind
.ReturnType, method), methodOrigin);
3440
MarkCustomAttributes(method.MethodReturnType, new DependencyInfo(
DependencyKind
.ReturnTypeAttribute, method), methodOrigin);
3441
MarkMarshalSpec(method.MethodReturnType, new DependencyInfo(
DependencyKind
.ReturnTypeMarshalSpec, method), methodOrigin);
3467
MarkMethodIf(declaringType.Methods, m => m.Name == methodPair, new DependencyInfo(
DependencyKind
.MethodForSpecialType, declaringType), methodOrigin);
3481
static
DependencyKind
PropagateDependencyKindToAccessors(
DependencyKind
parentDependencyKind,
DependencyKind
kind)
3486
case
DependencyKind
.AlreadyMarked:
3487
case
DependencyKind
.TypePreserve:
3488
case
DependencyKind
.PreservedMethod:
3489
case
DependencyKind
.DynamicallyAccessedMemberOnType:
3504
MarkFields(type, includeStatic: type.IsEnum, reason: new DependencyInfo(
DependencyKind
.MemberOfType, type), origin);
3577
if (!MarkDefaultConstructor(baseType, new DependencyInfo(
DependencyKind
.BaseDefaultCtorForStubbedMethod, method), origin))
3583
MarkAndCacheConvertToThrowExceptionCtor(new DependencyInfo(
DependencyKind
.UnreachableBodyRequirement, method), origin);
3626
var ctor = MarkMethodIf(disablePrivateReflection.Methods, MethodDefinitionExtensions.IsDefaultConstructor, new DependencyInfo(
DependencyKind
.DisablePrivateReflectionRequirement, disablePrivateReflection), emptyOrigin);
3651
MarkMethod(ov.Base, new DependencyInfo(
DependencyKind
.BaseMethod, method), origin);
3661
Annotations.MarkProcessed(pii.Module, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method));
3681
MarkDefaultConstructor(returnTypeDefinition, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3682
MarkFields(returnTypeDefinition, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3689
MarkFields(method.DeclaringType, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3706
MarkFields(paramTypeDefinition, includeStaticFields, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3709
MarkDefaultConstructor(paramTypeDefinition, new DependencyInfo(
DependencyKind
.InteropMethodDependency, method), origin);
3759
MarkCustomAttributes(prop, new DependencyInfo(
DependencyKind
.CustomAttribute, prop), propertyOrigin);
3766
DependencyKind
dependencyKind =
DependencyKind
.EventMethod;
3776
MarkCustomAttributes(evt, new DependencyInfo(
DependencyKind
.CustomAttribute, evt), eventOrigin);
3794
MarkAndCacheConvertToThrowExceptionCtor(new DependencyInfo(
DependencyKind
.UnreachableBodyRequirement, body.Method), origin);
3863
MarkType(var.VariableType, new DependencyInfo(
DependencyKind
.VariableType, methodIL.Method), origin);
3867
MarkType(eh.CatchType, new DependencyInfo(
DependencyKind
.CatchType, methodIL.Method), origin);
3934
MarkField((FieldReference)instruction.Operand, new DependencyInfo(
DependencyKind
.FieldAccess, method), origin);
3939
(
DependencyKind
dependencyKind, bool markForReflectionAccess) = instruction.OpCode.Code switch
3941
Code.Jmp => (
DependencyKind
.DirectCall, false),
3942
Code.Call => (
DependencyKind
.DirectCall, false),
3943
Code.Callvirt => (
DependencyKind
.VirtualCall, false),
3944
Code.Newobj => (
DependencyKind
.Newobj, false),
3945
Code.Ldvirtftn => (
DependencyKind
.Ldvirtftn, true),
3946
Code.Ldftn => (
DependencyKind
.Ldftn, true),
3971
var reason = new DependencyInfo(
DependencyKind
.Ldtoken, method);
4025
MarkType(operand, new DependencyInfo(
DependencyKind
.InstructionTypeRef, method), origin);
4042
Annotations.MarkProcessed(iface, reason ?? new DependencyInfo(
DependencyKind
.InterfaceImplementationOnType, origin.Provider));
4045
MarkCustomAttributes(iface, new DependencyInfo(
DependencyKind
.CustomAttribute, iface), origin);
4047
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);
145
Annotations.Mark(type, new DependencyInfo(
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin(type.Module.Assembly));
162
Annotations.Mark(type, new DependencyInfo(
DependencyKind
.RootAssembly, type.Module.Assembly), new MessageOrigin(type.Module.Assembly));
176
var di = new DependencyInfo(
DependencyKind
.RootAssembly, assembly);
199
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)
163
Debug.Assert(!(reason.Kind ==
DependencyKind
.AlreadyMarked));
177
Debug.Assert(!(reason.Kind ==
DependencyKind
.AlreadyMarked));
506
Mark(method, new DependencyInfo(
DependencyKind
.PreservedMethod, definition), new MessageOrigin(definition));
Linker\DependencyInfo.cs (5)
154
public
DependencyKind
Kind { get; }
156
public DependencyInfo(
DependencyKind
kind, object? source) => (Kind, Source) = (kind, source);
157
public static readonly DependencyInfo Unspecified = new DependencyInfo(
DependencyKind
.Unspecified, null);
158
public static readonly DependencyInfo AlreadyMarked = new DependencyInfo(
DependencyKind
.AlreadyMarked, null);
159
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 (5)
87
MarkTypeMapAttribute(entry, new DependencyInfo(
DependencyKind
.TypeMapEntry, callingMethod));
101
MarkTypeMapAttribute(entry, new DependencyInfo(
DependencyKind
.TypeMapEntry, callingMethod));
135
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapEntry, targetType));
189
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapEntry, null));
201
MarkTypeMapAttribute(attr, new DependencyInfo(
DependencyKind
.TypeMapEntry, trimTarget));
Linker\XmlDependencyRecorder.cs (1)
102
if (reason.Kind ==
DependencyKind
.Unspecified)