53 instantiations of EntityHandle
System.Reflection.Metadata (53)
667 references to EntityHandle
Crossgen2Tasks (2)
Microsoft.Cci.Extensions (3)
Microsoft.CodeAnalysis (185)
Emit\EditAndContinue\DeltaMetadataWriter.cs (15)
54private readonly Dictionary<EntityHandle, ImmutableArray<int>> _customAttributesAdded;
57private readonly List<(EntityHandle parentHandle, IEnumerator<ICustomAttribute> attributeEnumerator)> _deferredCustomAttributes = new();
117_customAttributesAdded = new Dictionary<EntityHandle, ImmutableArray<int>>();
923protected override void AddCustomAttributesToTable(EntityHandle parentHandle, IEnumerable<ICustomAttribute> attributes)
1043void addWithCap(EntityHandle parentHandle, IEnumerator<ICustomAttribute> attributeEnumerator, int limit)
1058var deletedParentHandle = MetadataTokens.EntityHandle(parentTableIndex, 0);
1059var deletedMemberRefHandle = MetadataTokens.EntityHandle(TableIndex.MemberRef, 0);
1244var tokens = ArrayBuilder<EntityHandle>.GetInstance();
1310foreach (var token in tokens)
1321var debugTokens = ArrayBuilder<EntityHandle>.GetInstance();
1328foreach (var token in debugTokens)
1390ArrayBuilder<EntityHandle> builder,
1398private static void AddReferencedTokens(ArrayBuilder<EntityHandle> tokens, TableIndex tableIndex, int firstRowId, int nTokens)
1406private static void AddDefinitionTokens<T>(ArrayBuilder<EntityHandle> tokens, TableIndex tableIndex, DefinitionIndex<T> index)
1415private static void AddRowNumberTokens(ArrayBuilder<EntityHandle> tokens, TableIndex tableIndex, ArrayBuilder<int> rowNumbers)
MetadataReader\MetadataDecoder.cs (22)
134internal TypeSymbol GetTypeOfToken(EntityHandle token)
140internal TypeSymbol GetTypeOfToken(EntityHandle token, out bool isNoPiaLocalType)
392EntityHandle tokenGeneric = ppSig.ReadTypeHandle();
435internal TypeSymbol GetSymbolForTypeHandleOrThrow(EntityHandle handle, out bool isNoPiaLocalType, bool allowTypeSpec, bool requireShortForm)
512EntityHandle resolutionScope;
544EntityHandle tokenResolutionScope,
589if (tokenResolutionScope == EntityHandle.ModuleDefinition)
771EntityHandle token = signatureReader.ReadTypeHandle();
905internal TypeSymbol DecodeGenericParameterConstraint(EntityHandle token, out ImmutableArray<ModifierInfo<TypeSymbol>> modifiers)
1592EntityHandle ctor;
1684EntityHandle attributeType;
1685EntityHandle ctor;
1715EntityHandle attributeType;
1716EntityHandle ctor;
1907EntityHandle methodDebugHandle;
1908EntityHandle implementedMethodHandle;
2052private void EnqueueTypeToken(Queue<TypeDefinitionHandle> typeDefsToSearch, Queue<TypeSymbol> typeSymbolsToSearch, EntityHandle typeToken)
2172internal Symbol GetSymbolForILToken(EntityHandle token)
2223EntityHandle method;
2255EntityHandle container = Module.GetContainingTypeOrThrow(memberRef);
2281internal MethodSymbol GetMethodSymbolForMethodDefOrMemberRef(EntityHandle memberToken, TypeSymbol container)
2291internal FieldSymbol GetFieldSymbolForFieldDefOrMemberRef(EntityHandle memberToken, TypeSymbol container)
MetadataReader\PEModule.cs (92)
415HashSet<EntityHandle> nameTokens = new HashSet<EntityHandle>();
419EntityHandle scope = typeRef.ResolutionScope;
426foreach (var token in nameTokens)
564public EntityHandle GetTypeDefExtendsOrThrow(TypeDefinitionHandle typeDef)
593out EntityHandle extends)
922internal EntityHandle GetBaseTypeOfTypeOrThrow(TypeDefinitionHandle typeDef)
985internal bool HasParamArrayAttribute(EntityHandle token)
990internal bool HasParamCollectionAttribute(EntityHandle token)
995internal bool HasIsReadOnlyAttribute(EntityHandle token)
1000internal bool HasDoesNotReturnAttribute(EntityHandle token)
1005internal bool HasIsUnmanagedAttribute(EntityHandle token)
1010internal bool HasExtensionAttribute(EntityHandle token, bool ignoreCase)
1015internal bool HasVisualBasicEmbeddedAttribute(EntityHandle token)
1020internal bool HasCodeAnalysisEmbeddedAttribute(EntityHandle token)
1025internal bool HasInterpolatedStringHandlerAttribute(EntityHandle token)
1030internal bool HasDefaultMemberAttribute(EntityHandle token, out string memberName)
1035internal bool HasGuidAttribute(EntityHandle token, out string guidValue)
1040internal bool HasImportedFromTypeLibAttribute(EntityHandle token, out string libValue)
1045internal bool HasPrimaryInteropAssemblyAttribute(EntityHandle token, out int majorValue, out int minorValue)
1050internal bool HasFixedBufferAttribute(EntityHandle token, out string elementTypeName, out int bufferSize)
1055internal bool HasAccessedThroughPropertyAttribute(EntityHandle token, out string propertyName)
1060internal bool HasRequiredAttributeAttribute(EntityHandle token)
1065internal bool HasCollectionBuilderAttribute(EntityHandle token, out string builderTypeName, out string methodName)
1078internal bool HasAttribute(EntityHandle token, AttributeDescription description)
1083internal CustomAttributeHandle GetAttributeHandle(EntityHandle token, AttributeDescription description)
1090internal bool HasDynamicAttribute(EntityHandle token, out ImmutableArray<bool> transformFlags)
1110internal bool HasNativeIntegerAttribute(EntityHandle token, out ImmutableArray<bool> transformFlags)
1130internal bool HasScopedRefAttribute(EntityHandle token)
1135internal bool HasUnscopedRefAttribute(EntityHandle token)
1140internal bool HasRefSafetyRulesAttribute(EntityHandle token, out int version, out bool foundAttributeType)
1173internal bool HasTupleElementNamesAttribute(EntityHandle token, out ImmutableArray<string> tupleElementNames)
1187internal bool HasIsByRefLikeAttribute(EntityHandle token)
1192internal bool HasRequiresLocationAttribute(EntityHandle token)
1202EntityHandle token,
1250/// <see cref="TryGetDeprecatedOrExperimentalOrObsoleteAttribute(EntityHandle, IAttributeNamedArgumentDecoder, bool, bool)"/>
1267internal ObsoleteAttributeData? TryDecodeExperimentalAttributeData(EntityHandle handle, IAttributeNamedArgumentDecoder decoder)
1340internal string? GetFirstUnsupportedCompilerFeatureFromToken(EntityHandle token, IAttributeNamedArgumentDecoder attributeNamedArgumentDecoder, CompilerFeatureRequiredFeatures allowedFeatures)
1395EntityHandle token,
1439internal (ImmutableArray<string?> Names, bool FoundAttribute) GetInterpolatedStringHandlerArgumentAttributeValues(EntityHandle token)
1466internal bool HasMaybeNullWhenOrNotNullWhenOrDoesNotReturnIfAttribute(EntityHandle token, AttributeDescription description, out bool when)
1482internal ImmutableHashSet<string> GetStringValuesOfNotNullIfNotNullAttribute(EntityHandle token)
1503internal bool HasAttributeUsageAttribute(EntityHandle token, IAttributeNamedArgumentDecoder attributeNamedArgumentDecoder, out AttributeUsageInfo usageInfo)
1551internal bool HasInterfaceTypeAttribute(EntityHandle token, out ComInterfaceType interfaceType)
1563internal bool HasTypeLibTypeAttribute(EntityHandle token, out Cci.TypeLibTypeFlags flags)
1575internal bool HasDateTimeConstantAttribute(EntityHandle token, out ConstantValue defaultValue)
1598internal bool HasDecimalConstantAttribute(EntityHandle token, out ConstantValue defaultValue)
1612internal bool HasNullablePublicOnlyAttribute(EntityHandle token, out bool includesInternals)
1628internal ImmutableArray<string> GetInternalsVisibleToAttributeValues(EntityHandle token)
1635internal ImmutableArray<string> GetConditionalAttributeValues(EntityHandle token)
1645internal ImmutableArray<string> GetMemberNotNullAttributeValues(EntityHandle token)
1685internal (ImmutableArray<string> whenTrue, ImmutableArray<string> whenFalse) GetMemberNotNullWhenAttributeValues(EntityHandle token)
2032internal bool HasStringValuedAttribute(EntityHandle token, AttributeDescription description, out string value)
2044private bool HasIntAndIntValuedAttribute(EntityHandle token, AttributeDescription description, out int value1, out int value2)
2057private bool HasStringAndIntValuedAttribute(EntityHandle token, AttributeDescription description, out string stringValue, out int intValue)
2492internal List<AttributeInfo>? FindTargetAttributes(EntityHandle hasAttribute, AttributeDescription description)
2520internal AttributeInfo FindTargetAttribute(EntityHandle hasAttribute, AttributeDescription description)
2525internal static AttributeInfo FindTargetAttribute(MetadataReader metadataReader, EntityHandle hasAttribute, AttributeDescription description, out bool foundAttributeType)
2552internal AttributeInfo FindLastTargetAttribute(EntityHandle hasAttribute, AttributeDescription description)
2575internal int GetParamArrayCountOrThrow(EntityHandle hasAttribute)
2724out EntityHandle ctor,
2745out EntityHandle ctor,
2751EntityHandle ctorType;
2817internal EntityHandle GetTypeRef(
2818EntityHandle resolutionScope,
2864out EntityHandle resolutionScope)
2909EntityHandle ctor;
2952EntityHandle token = sig.ReadTypeHandle();
3033out EntityHandle ctorType,
3034out EntityHandle attributeCtor)
3047out EntityHandle ctorType,
3048out EntityHandle attributeCtor)
3052ctorType = default(EntityHandle);
3093ctorType = default(EntityHandle);
3094attributeCtor = default(EntityHandle);
3104internal bool GetAttributeNamespaceAndName(EntityHandle typeDefOrRef, out StringHandle namespaceHandle, out StringHandle nameHandle)
3114private static bool GetAttributeNamespaceAndName(MetadataReader metadataReader, EntityHandle typeDefOrRef, out StringHandle namespaceHandle, out StringHandle nameHandle)
3202internal bool HasNullableContextAttribute(EntityHandle token, out byte value)
3216internal bool HasNullableAttribute(EntityHandle token, out byte defaultTransform, out ImmutableArray<byte> nullableTransforms)
3237internal bool TryGetOverloadResolutionPriorityValue(EntityHandle token, out int decodedPriority)
3270internal void GetMethodSpecificationOrThrow(MethodSpecificationHandle handle, out EntityHandle method, out BlobHandle instantiation)
3315internal BlobHandle GetMethodSignatureOrThrow(EntityHandle methodDefOrRef)
3321private static BlobHandle GetMethodSignatureOrThrow(MetadataReader metadataReader, EntityHandle methodDefOrRef)
3355internal EntityHandle GetContainingTypeOrThrow(MemberReferenceHandle memberRef)
3379out EntityHandle body,
3380out EntityHandle declaration)
3453out EntityHandle @class,
3533out EntityHandle type)
3614public CustomAttributeHandleCollection GetCustomAttributesOrThrow(EntityHandle handle)
3628private BlobHandle GetMarshallingDescriptorHandleOrThrow(EntityHandle fieldOrParameterToken)
3635internal UnmanagedType GetMarshallingType(EntityHandle fieldOrParameterToken)
3658internal ImmutableArray<byte> GetMarshallingDescriptor(EntityHandle fieldOrParameterToken)
PEWriter\MetadataWriter.cs (42)
423private EntityHandle[] _pseudoSymbolTokenToTokenMap;
465_pseudoSymbolTokenToTokenMap = new EntityHandle[referencesInIL.Length];
724private EntityHandle GetCustomAttributeTypeCodedIndex(IMethodReference methodReference)
734? (EntityHandle)GetMethodDefinitionHandle(methodDef)
827internal EntityHandle GetFieldHandle(IFieldReference fieldReference)
837? (EntityHandle)GetFieldDefinitionHandle(fieldDef)
896private EntityHandle GetExportedTypeImplementation(INamespaceTypeReference namespaceRef)
907? (EntityHandle)GetAssemblyFileHandle(mref)
925internal EntityHandle GetMemberReferenceParent(ITypeMemberReference memberRef)
960? (EntityHandle)GetTypeSpecificationHandle(containingType)
964internal EntityHandle GetMethodDefinitionOrReferenceHandle(IMethodReference methodReference)
974? (EntityHandle)GetMethodDefinitionHandle(methodDef)
1163internal EntityHandle GetMethodHandle(IMethodReference methodReference)
1185? (EntityHandle)GetMethodSpecificationHandle(methodSpec)
1189internal EntityHandle GetStandaloneSignatureHandle(ISignature signature)
1295private EntityHandle GetResolutionScopeHandle(IUnitReference unitReference)
1578private EntityHandle GetDeclaringTypeOrMethodHandle(IGenericParameter genPar)
1660internal EntityHandle GetTypeHandle(ITypeReference typeReference, bool treatRefAsPotentialTypeSpec = true)
1670? (EntityHandle)GetTypeSpecificationHandle(typeReference)
1674internal EntityHandle GetDefinitionHandle(IDefinition definition)
1678ITypeDefinition typeDef => (EntityHandle)GetTypeDefinitionHandle(typeDef),
2052EntityHandle parentHandle = Handle.AssemblyDefinition;
2090AddCustomAttributesToTable(EntityHandle.ModuleDefinition, module.GetSourceModuleAttributes());
2105var parentHandle = MetadataTokens.Handle(tableIndex, parentRowId++);
2110private void AddCustomAttributesToTable<T>(IEnumerable<T> parentList, Func<T, EntityHandle> getDefinitionHandle)
2121EntityHandle parentHandle = getDefinitionHandle(parent);
2126protected virtual void AddCustomAttributesToTable(EntityHandle parentHandle, IEnumerable<ICustomAttribute> attributes)
2134protected bool AddCustomAttributeToTable(EntityHandle parentHandle, ICustomAttribute customAttribute)
2154this.PopulateDeclSecurityTableRowsFor(EntityHandle.AssemblyDefinition, module.GetSourceAssemblySecurityAttributes());
2178private void PopulateDeclSecurityTableRowsFor(EntityHandle parentHandle, IEnumerable<SecurityAttribute> attributes)
2240EntityHandle implementation;
2520implementation: default(EntityHandle),
2527EntityHandle implementation;
2536implementation = default(EntityHandle);
2785baseType: (baseType != null) ? GetTypeHandle(baseType) : default(EntityHandle),
2830EntityHandle resolutionScope;
3106private EntityHandle GetHandle(object reference)
3118private EntityHandle ResolveEntityHandleFromPseudoToken(int pseudoSymbolToken)
3135EntityHandle handle = GetHandle(entity);
3271var handle = ResolveEntityHandleFromPseudoToken(pseudoToken & 0x00ffffff);
3279var handle = ResolveEntityHandleFromPseudoToken(pseudoToken & 0x00ffffff);
3386(exceptionType != null) ? GetTypeHandle(exceptionType) : default(EntityHandle),
Microsoft.CodeAnalysis.CSharp (29)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (5)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (7)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (6)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (6)
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (3)
Microsoft.CodeAnalysis.Features (7)
Microsoft.CodeAnalysis.Rebuild (1)
Microsoft.CodeAnalysis.Test.Utilities (12)
Microsoft.CodeAnalysis.VisualBasic (18)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (12)
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces (32)
FindSymbols\SymbolTree\SymbolTreeInfo.FirstEntityHandleProvider.cs (27)
21private sealed class FirstEntityHandleProvider : ISignatureTypeProvider<EntityHandle, object?>
25public EntityHandle GetTypeFromSpecification(MetadataReader reader, TypeSpecificationHandle handle)
31return new SignatureDecoder<EntityHandle, object?>(this, reader, genericContext: null).DecodeType(ref sigReader);
34public EntityHandle GetTypeFromSpecification(MetadataReader reader, object? genericContext, TypeSpecificationHandle handle, byte rawTypeKind)
37public EntityHandle GetTypeFromDefinition(MetadataReader reader, TypeDefinitionHandle handle, byte rawTypeKind) => handle;
38public EntityHandle GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, byte rawTypeKind) => handle;
41public EntityHandle GetGenericInstantiation(EntityHandle genericType, ImmutableArray<EntityHandle> typeArguments) => genericType;
45public EntityHandle GetModifiedType(EntityHandle modifier, EntityHandle unmodifiedType, bool isRequired) => unmodifiedType;
46public EntityHandle GetPinnedType(EntityHandle elementType) => elementType;
47public EntityHandle GetArrayType(EntityHandle elementType, ArrayShape shape) => elementType;
48public EntityHandle GetByReferenceType(EntityHandle elementType) => elementType;
49public EntityHandle GetPointerType(EntityHandle elementType) => elementType;
50public EntityHandle GetSZArrayType(EntityHandle elementType) => elementType;
55public EntityHandle GetFunctionPointerType(MethodSignature<EntityHandle> signature) => default;
56public EntityHandle GetGenericMethodParameter(object? genericContext, int index) => default;
57public EntityHandle GetGenericTypeParameter(object? genericContext, int index) => default;
59public EntityHandle GetPrimitiveType(PrimitiveTypeCode typeCode) => default;
Microsoft.DotNet.SignTool (2)
Roslyn.Test.PdbUtilities (6)
SemanticSearch.BuildTask (1)
System.Diagnostics.FileVersionInfo (3)
System.Reflection.Emit (31)
System\Reflection\Emit\ModuleBuilderImpl.cs (28)
23private readonly Dictionary<Type, EntityHandle> _typeReferences = new();
24private readonly Dictionary<object, EntityHandle> _memberReferences = new();
150EntityHandle parent = default;
679internal void WriteCustomAttributes(List<CustomAttributeWrapper>? customAttributes, EntityHandle parent)
691private EntityHandle GetTypeReferenceOrSpecificationHandle(Type type)
693if (!_typeReferences.TryGetValue(type, out var typeHandle))
722private MethodSpecificationHandle AddMethodSpecification(EntityHandle methodHandle, Type[] genericArgs) =>
729private EntityHandle GetMemberReferenceHandle(MemberInfo memberInfo)
731if (!_memberReferences.TryGetValue(memberInfo, out var memberHandle))
778private EntityHandle GetMethodReference(MethodInfo methodInfo, Type[] optionalParameterTypes)
783if (!_memberReferences.TryGetValue(pair, out var memberHandle))
869private void AddGenericTypeParametersAndConstraintsCustomAttributes(EntityHandle parentHandle, GenericTypeParameterBuilderImpl gParam)
884private void AddDefaultValue(EntityHandle parentHandle, object? defaultValue)
899private void AddMethodSemantics(EntityHandle parentHandle, MethodSemanticsAttributes attribute, MethodDefinitionHandle methodHandle) =>
911private EventDefinitionHandle AddEventDefinition(EventBuilderImpl eventBuilder, EntityHandle eventType) =>
933private TypeDefinitionHandle AddTypeDefinition(TypeBuilderImpl type, EntityHandle parent, int methodToken, int fieldToken) =>
951private TypeReferenceHandle AddTypeReference(EntityHandle resolutionScope, string? ns, string name) =>
957private MemberReferenceHandle AddMemberReference(string memberName, EntityHandle parent, BlobBuilder signature) =>
977private void AddMarshalling(EntityHandle parent, BlobBuilder builder) =>
996internal EntityHandle GetTypeHandle(Type type)
1015internal EntityHandle GetMemberHandle(MemberInfo member)
1072internal EntityHandle TryGetFieldHandle(FieldInfo field)
1082private static int GetTokenForHandle(EntityHandle handle)
1092private EntityHandle GetHandleForMember(MemberInfo member)
1137internal EntityHandle TryGetTypeHandle(Type type)
1159internal EntityHandle TryGetConstructorHandle(ConstructorInfo constructor)
1171internal EntityHandle TryGetMethodHandle(MethodInfo method)
1193internal EntityHandle TryGetMethodHandle(MethodInfo method, Type[] optionalParameterTypes)
System.Reflection.Metadata (264)
System.Reflection.MetadataLoadContext (24)
System\Reflection\TypeLoading\General\Ecma\EcmaResolver.cs (7)
14public static RoType ResolveTypeDefRefOrSpec(this EntityHandle handle, EcmaModule module, in TypeContext typeContext)
36private static readonly Func<EntityHandle, EcmaModule, EcmaDefinitionType> s_resolveTypeDef =
47private static readonly Func<EntityHandle, EcmaModule, RoDefinitionType> s_resolveTypeRef =
57EntityHandle scope = tr.ResolutionScope;
134private static readonly Func<EntityHandle, EcmaModule, EcmaGenericParameterType> s_resolveGenericParam =
135(EntityHandle h, EcmaModule module) =>
173private static readonly Func<EntityHandle, EcmaModule, RoAssembly> s_resolveAssembly =