483 references to MetadataTokens
ILAssembler (15)
EntityRegistry.cs (11)
102((IHasHandle)Assembly).SetHandle(MetadataTokens.EntityHandle(0x20000001)); 505return MetadataTokens.EntityHandle(tokenType, MetadataTokens.GetRowNumber(otherList[otherList.Count - 1].Handle) + 1); 510return MetadataTokens.EntityHandle(tokenType, 1); 591((IHasHandle)entity).SetHandle(MetadataTokens.EntityHandle(table, entities.Count)); 670_ = MetadataTokens.TryGetTableIndex(entityHandle.Kind, out var tableIndex); 673int rowNumber = MetadataTokens.GetRowNumber(entityHandle); 964var typeDef = (TypeDefinitionEntity)GetSeenEntities(TableIndex.TypeDef)[MetadataTokens.GetRowNumber(type.Handle) - 1]; 1150TypeSignatureHandle = MetadataTokens.TypeDefinitionHandle(MetadataTokens.GetRowNumber(realEntity)); 1371writer.WriteInt32(MetadataTokens.GetToken(token));
GrammarVisitor.cs (4)
155MetadataTokens.GetToken(method.Handle), 302methodTokens[method.VTableSlot - 1] = MetadataTokens.GetToken(method.Handle); 3556return new(_entityRegistry.ResolveHandleToEntity(MetadataTokens.EntityHandle(VisitInt32(context.int32()).Value))); 5321return new(new EntityRegistry.FakeTypeEntity(MetadataTokens.ModuleReferenceHandle(0)));
ILCompiler.Compiler (18)
Compiler\MstatObjectDumper.cs (1)
150_manifestResources.LoadConstantI4(MetadataTokens.GetToken(_emitter.GetAssemblyRef(resource.Assembly)));
Compiler\ReachabilityInstrumentationFilter.cs (1)
64int rowNumber = MetadataTokens.GetRowNumber(ecmaMethod.Handle);
Compiler\ReachabilityInstrumentationProvider.cs (6)
59ref ExternSymbolMappedField field = ref fields[MetadataTokens.GetRowNumber(ecmaMethod.Handle)]; 62string name = $"__tokenuse_{ecmaMethod.MetadataReader.GetGuid(ecmaMethod.MetadataReader.GetModuleDefinition().Mvid):N}_{MetadataTokens.GetToken(ecmaMethod.Handle):X8}"; 114BinaryPrimitives.WriteInt32LittleEndian(newBytes.AsSpan()[2..6], MetadataTokens.GetToken(MetadataTokens.FieldDefinitionHandle(0))); 124if (token == MetadataTokens.GetToken(MetadataTokens.FieldDefinitionHandle(0)))
Compiler\UserDefinedTypeDescriptor.cs (1)
65Name = new Utf8String($"StateMachineLocals_{System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(((EcmaType)defType.GetTypeDefinition()).Handle):X}"),
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.cs (6)
372EntityHandle accessedType = MetadataTokens.EntityHandle(reader.ReadILToken()); 376var t = methodIL.GetObject(MetadataTokens.GetToken(accessedType), NotFoundBehavior.ReturnNull) as TypeDesc; 390EntityHandle accessedField = MetadataTokens.EntityHandle(reader.ReadILToken()); 405EntityHandle accessedMethod = MetadataTokens.EntityHandle(reader.ReadILToken()); 411var m = methodIL.GetObject(MetadataTokens.GetToken(accessedMethod), NotFoundBehavior.ReturnNull) as MethodDesc; 421EntityHandle accessedEntity = MetadataTokens.EntityHandle(reader.ReadILToken());
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\OutputInfoBuilder.cs (1)
192methodInfo.MethodToken = (uint)MetadataTokens.GetToken(ecmaMethod.Handle);
src\runtime\src\coreclr\tools\Common\TypeSystem\MetadataEmitter\TypeSystemMetadataEmitter.cs (2)
53fieldList: MetadataTokens.FieldDefinitionHandle(1), 54methodList: MetadataTokens.MethodDefinitionHandle(1));
ILCompiler.MetadataTransform (1)
ILCompiler\Metadata\Transform.Scope.cs (1)
75Ecma.CustomAttributeHandleCollection moduleAttributes = reader.GetCustomAttributes(Ecma.Ecma335.MetadataTokens.EntityHandle(0x1));
ILCompiler.ReadyToRun (73)
Compiler\DependencyAnalysis\ReadyToRun\CopiedFieldRvaNode.cs (1)
84EcmaField field = _module.GetField(MetadataTokens.FieldDefinitionHandle(currentFieldRid));
Compiler\DependencyAnalysis\ReadyToRun\CopiedMetadataBlobNode.cs (2)
62var methodDefHandle = MetadataTokens.EntityHandle(TableIndex.MethodDef, i); 96EntityHandle fieldHandle = MetadataTokens.EntityHandle(TableIndex.Field, fieldToken);
Compiler\DependencyAnalysis\ReadyToRun\EnclosingTypeMapNode.cs (1)
64builder.EmitUShort(checked((ushort)MetadataTokens.GetRowNumber(typeDefinition.GetDeclaringType())));
Compiler\DependencyAnalysis\ReadyToRun\InliningInfoNode.cs (8)
146int inlineeRid = MetadataTokens.GetRowNumber(ecmaInlinee.Handle); 190int aRid = MetadataTokens.GetRowNumber(a.Handle); 191int bRid = MetadataTokens.GetRowNumber(b.Handle); 205int inlinerRid = MetadataTokens.GetRowNumber(inliner.Handle); 273int aRid = MetadataTokens.GetRowNumber(a.Handle); 274int bRid = MetadataTokens.GetRowNumber(b.Handle); 306indexOfInlinee = (uint)MetadataTokens.GetRowNumber(ecmaInlinee.Handle); 340uint inlinerRid = (uint)MetadataTokens.GetRowNumber(inliner.Handle);
Compiler\DependencyAnalysis\ReadyToRun\ManifestMetadataTableNode.cs (1)
131AssemblyReferenceHandle assemblyRefHandle = MetadataTokens.AssemblyReferenceHandle(assemblyRefIndex);
Compiler\DependencyAnalysis\ReadyToRun\MethodEntryPointTableNode.cs (1)
58uint rid = SignatureBuilder.RidFromToken((mdToken)MetadataTokens.GetToken(ecmaMethod.Handle));
Compiler\DependencyAnalysis\ReadyToRun\ModuleToken.cs (3)
31Token = (mdToken)MetadataTokens.GetToken(entityHandle); 37Token = (mdToken)MetadataTokens.GetToken(handle); 82public Handle Handle => MetadataTokens.Handle((int)Token);
Compiler\DependencyAnalysis\ReadyToRun\ModuleTokenResolver.cs (1)
63return new ModuleToken(ecmaType.Module, (mdToken)MetadataTokens.GetToken(ecmaType.Handle));
Compiler\DependencyAnalysis\ReadyToRun\TypesTableNode.cs (2)
56typesHashtable.Append(unchecked((uint)hashCode), section.Place(new UnsignedConstant(((uint)MetadataTokens.GetRowNumber(defTypeInfo.Handle) << 1) | 0))); 76typesHashtable.Append(unchecked((uint)hashCode), section.Place(new UnsignedConstant(((uint)MetadataTokens.GetRowNumber(expTypeInfo.Handle) << 1) | 1)));
Compiler\ReadyToRunStandaloneMethodMetadata.cs (15)
55MetadataTokens.GetToken(exceptionRegion.CatchType), 86int encodedToken = CodedIndex.TypeDefOrRefOrSpec(MetadataTokens.EntityHandle(alternateToken)); 127var handle = MetadataTokens.Handle(token); 131EcmaType ecmaType = (EcmaType)wrappedMethod.Module.GetObject(MetadataTokens.EntityHandle(token)); 132alternateToken = MetadataTokens.GetToken(alternateTypes.GetTypeDefOrRefHandleForTypeDesc(ecmaType)); 164blob.WriteCompressedInteger(CodedIndex.MemberRefParent(MetadataTokens.EntityHandle(GetAlternateStreamToken(MetadataTokens.GetToken(memberReference.Parent))))); 174blob.WriteCompressedInteger(CodedIndex.MemberRefParent(MetadataTokens.EntityHandle(GetAlternateStreamToken(MetadataTokens.GetToken(methodDefinition.GetDeclaringType()))))); 184blob.WriteCompressedInteger(CodedIndex.MemberRefParent(MetadataTokens.EntityHandle(GetAlternateStreamToken(MetadataTokens.GetToken(fieldDefinition.GetDeclaringType()))))); 191blob.WriteCompressedInteger(MetadataTokens.GetRowNumber(MetadataTokens.EntityHandle(GetAlternateStreamToken(MetadataTokens.GetToken(methodSpecification.Method))))); 225result = MetadataTokens.TypeReferenceHandle(_alternateTypeRefStream.Count);
IBC\IBCProfileParser.cs (6)
109object metadataObject = ecmaModule.GetObject(System.Reflection.Metadata.Ecma335.MetadataTokens.EntityHandle((int)entry.Token), NotFoundBehavior.ReturnNull); 340enclosingType = MetadataTokens.TypeDefinitionHandle((int)Cor.Macros.RidFromToken(enclosingTypeTokenValue)); 435return (uint)MetadataTokens.GetToken(ecmaCandidateMethod.Handle); 460return EcmaModule.GetObject(MetadataTokens.EntityHandle(((int)CorTokenType.mdtAssemblyRef) | index), NotFoundBehavior.ReturnNull) as EcmaModule; 687var result = (MetadataType)ecmaModule.GetType(MetadataTokens.EntityHandle((int)token)); 741MethodDesc ecmaMethod = ecmaModuleOfMethod.GetMethod(MetadataTokens.EntityHandle((int)methodToken));
IL\ReadyToRunILProvider.cs (2)
377return _mutableModule.GetUserString(System.Reflection.Metadata.Ecma335.MetadataTokens.UserStringHandle(token)); 379return _mutableModule.GetObject(System.Reflection.Metadata.Ecma335.MetadataTokens.EntityHandle(token), notFoundBehavior);
JitInterface\CorInfoImpl.ReadyToRun.cs (6)
534TypeSpecificationHandle handle = MetadataTokens.TypeSpecificationHandle(i); 542return (mdToken)MetadataTokens.GetToken(handle); 1433mdToken token = (mdToken)MetadataTokens.GetToken(ecmaMethod.Handle); 1497token = (mdToken)MetadataTokens.GetToken(((EcmaMethod)resultMethod).Handle); 1514token = (mdToken)MetadataTokens.GetToken(((EcmaField)resultField).Handle); 1548token = (mdToken)MetadataTokens.GetToken(ecmaType.Handle);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.cs (6)
372EntityHandle accessedType = MetadataTokens.EntityHandle(reader.ReadILToken()); 376var t = methodIL.GetObject(MetadataTokens.GetToken(accessedType), NotFoundBehavior.ReturnNull) as TypeDesc; 390EntityHandle accessedField = MetadataTokens.EntityHandle(reader.ReadILToken()); 405EntityHandle accessedMethod = MetadataTokens.EntityHandle(reader.ReadILToken()); 411var m = methodIL.GetObject(MetadataTokens.GetToken(accessedMethod), NotFoundBehavior.ReturnNull) as MethodDesc; 421EntityHandle accessedEntity = MetadataTokens.EntityHandle(reader.ReadILToken());
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\OutputInfoBuilder.cs (1)
192methodInfo.MethodToken = (uint)MetadataTokens.GetToken(ecmaMethod.Handle);
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (1)
3525return (mdToken)System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(ecmaMethodDefinition.Handle);
src\runtime\src\coreclr\tools\Common\TypeSystem\MetadataEmitter\TypeSystemMetadataEmitter.cs (2)
53fieldList: MetadataTokens.FieldDefinitionHandle(1), 54methodList: MetadataTokens.MethodDefinitionHandle(1));
TypeSystem\Mutable\MutableModule.cs (14)
72result = MetadataTokens.ModuleReferenceHandle(_moduleRefStrings.Count); 206if (!Entities.ContainsKey(MetadataTokens.GetToken(item.Value))) 208Entities.Add(MetadataTokens.GetToken(item.Value), item.Key); 209ExistingEntities.Add(item.Key, MetadataTokens.GetToken(item.Value)); 312return MetadataTokens.GetToken(emitter.EmitMetadataHandleForTypeSystemEntity((TypeSystemEntity)type)); 317return MetadataTokens.GetToken(emitter.GetUserStringHandle((string)str)); 322return MetadataTokens.GetToken(emitter.GetAssemblyRef((AssemblyNameInfo)name)); 332return MetadataTokens.EntityHandle(handle.Value); 341return MetadataTokens.EntityHandle(handle); 344return MetadataTokens.EntityHandle(handle); 379if (_cache.Entities.TryGetValue(MetadataTokens.GetToken(handle), out var result)) 386if (_cache.Entities.TryGetValue(MetadataTokens.GetToken(handle), out result)) 392throw new ArgumentException($"Invalid EntityHandle {MetadataTokens.GetToken(handle):X} passed to MutableModule.GetObject"); 399if (_cache.Entities.TryGetValue(MetadataTokens.GetToken(handle), out var result))
ILCompiler.RyuJit (1)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (1)
3525return (mdToken)System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(ecmaMethodDefinition.Handle);
ILCompiler.TypeSystem (21)
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaModule.cs (6)
258EntityHandle handle = MetadataTokens.EntityHandle(entryPointToken); 306ref TypeDefinitionHandle entry = ref buckets[MetadataTokens.GetRowNumber(typeHandle)]; 333entry = _typeDefinitionBuckets[MetadataTokens.GetRowNumber(entry)]; 357ref ExportedTypeHandle entry = ref buckets[MetadataTokens.GetRowNumber(typeHandle)]; 384entry = _exportedTypeBuckets[MetadataTokens.GetRowNumber(entry)]; 770return (EcmaType)GetType(MetadataTokens.EntityHandle(0x02000001 /* COR_GLOBAL_PARENT_TOKEN */));
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaSignatureTranslator.cs (2)
114int token = MetadataTokens.GetToken(_input.ReadTypeHandle()); 116int newEncodedHandle = CodedIndex.TypeDefOrRefOrSpec(MetadataTokens.EntityHandle(newToken));
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaType.cs (1)
651return _handle.Equals(MetadataTokens.TypeDefinitionHandle(0x00000001 /* COR_GLOBAL_PARENT_TOKEN */));
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\SymbolReader\PortablePdbSymbolReader.cs (4)
113var debugInformationHandle = ((MethodDefinitionHandle)MetadataTokens.EntityHandle(methodToken)).ToDebugInformationHandle(); 118return kickoffMethod.IsNil ? 0 : MetadataTokens.GetToken(kickoffMethod); 138var debugInformationHandle = ((MethodDefinitionHandle)MetadataTokens.EntityHandle(methodToken)).ToDebugInformationHandle(); 199var debugInformationHandle = MetadataTokens.MethodDefinitionHandle(methodToken).ToDebugInformationHandle();
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\EcmaMethodIL.cs (5)
125MetadataTokens.GetToken(exceptionRegion.CatchType), 138return _module.GetUserString(MetadataTokens.UserStringHandle(token)); 140return _module.GetObject(MetadataTokens.EntityHandle(token), notFoundBehavior); 180return _module.GetUserString(MetadataTokens.UserStringHandle(token)); 182return _module.GetObject(MetadataTokens.EntityHandle(token), notFoundBehavior);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\EcmaMethodIL.Symbols.cs (3)
40? reader.GetStateMachineKickoffMethod(MetadataTokens.GetToken(_method.Handle)) != 0 49? reader.GetSequencePointsForMethod(MetadataTokens.GetToken(_method.Handle)) 57? reader.GetLocalVariableNamesForMethod(MetadataTokens.GetToken(_method.Handle))
Microsoft.CodeAnalysis (145)
Emit\EditAndContinue\DefinitionMap.cs (13)
126=> MetadataTokens.EntityHandle(SourceToMetadataSymbolMatcher.MapDefinition(def)?.GetInternalSymbol()?.MetadataToken ?? 0); 151handle = MetadataTokens.MethodDefinitionHandle(methodIndex); 182return MetadataTokens.MethodDefinitionHandle(methodRowId); 190return (MethodDefinitionHandle)MetadataTokens.EntityHandle(peMethod.MetadataToken); 208return MetadataTokens.PropertyDefinitionHandle(propertyRowId); 216return (PropertyDefinitionHandle)MetadataTokens.EntityHandle(peProperty.MetadataToken); 234return MetadataTokens.EventDefinitionHandle(eventRowId); 242return (EventDefinitionHandle)MetadataTokens.EntityHandle(peEvent.MetadataToken); 299int methodIndex = MetadataTokens.GetRowNumber(methodHandle); 358MetadataTokens.GetToken(methodHandle), 443MetadataTokens.GetToken(localSignature), 729var methodRowId = MetadataTokens.GetRowNumber(methodHandle); 751provider = Baseline.DebugInformationProvider(MetadataTokens.MethodDefinitionHandle(methodRowId));
Emit\EditAndContinue\DeletedPEMethodDefinition.cs (1)
37=> MetadataTokens.MethodDefinitionHandle(_oldMethod.MetadataToken);
Emit\EditAndContinue\DeltaMetadataWriter.cs (53)
165var sizes = new int[MetadataTokens.TableCount]; 195addedOrChangedMethodsByIndex.Add(MetadataTokens.GetRowNumber(GetMethodDefinitionHandle(pair.Key)), pair.Value); 200var tableSizes = new int[MetadataTokens.TableCount]; 305methods.Add(MetadataTokens.MethodDefinitionHandle(_methodDefs.GetRowId(def))); 338return MetadataTokens.EventDefinitionHandle(_eventDefs.GetRowId(def)); 348return MetadataTokens.FieldDefinitionHandle(_fieldDefs.GetRowId(def)); 359handle = MetadataTokens.TypeDefinitionHandle(rowId); 365return MetadataTokens.TypeDefinitionHandle(_typeDefs.GetRowId(def)); 370return _typeDefs.GetDefinition(MetadataTokens.GetRowNumber(handle)); 381handle = MetadataTokens.MethodDefinitionHandle(rowId); 386=> MetadataTokens.MethodDefinitionHandle(_methodDefs.GetRowId(def)); 389=> _methodDefs.GetDefinition(MetadataTokens.GetRowNumber(index)); 395=> MetadataTokens.PropertyDefinitionHandle(_propertyDefs.GetRowId(def)); 401=> MetadataTokens.ParameterHandle(_parameterDefs.GetRowId(def)); 432return MetadataTokens.AssemblyReferenceHandle(_assemblyRefIndex.GetOrAdd(identity)); 442return MetadataTokens.ModuleReferenceHandle(_moduleRefIndex.GetOrAdd(reference)); 452return MetadataTokens.MemberReferenceHandle(_memberRefIndex.GetOrAdd(reference)); 462return MetadataTokens.MethodSpecificationHandle(_methodSpecIndex.GetOrAdd(reference)); 476handle = MetadataTokens.TypeReferenceHandle(index); 482return MetadataTokens.TypeReferenceHandle(_typeRefIndex.GetOrAdd(reference)); 492return MetadataTokens.TypeSpecificationHandle(_typeSpecIndex.GetOrAdd(reference)); 502return MetadataTokens.StandaloneSignatureHandle(_standAloneSignatureIndex.GetOrAdd(blobIndex)); 814if (_previousGeneration.OriginalMetadata.MetadataReader.GetTableRowCount(TableIndex.MethodDef) >= MetadataTokens.GetRowNumber(handle)) 847_existingParameterDefs.Add(paramDef, MetadataTokens.GetRowNumber(param)); 1027int xOrdinal = MetadataTokens.GetRowNumber(_previousGeneration.OriginalMetadata.MetadataReader.GetCustomAttributes(x.parentHandle).FirstOrDefault()); 1028int yOrdinal = MetadataTokens.GetRowNumber(_previousGeneration.OriginalMetadata.MetadataReader.GetCustomAttributes(y.parentHandle).FirstOrDefault()); 1066CustomAttributeRowIds.Add(MetadataTokens.GetRowNumber(handle)); 1121_ = MetadataTokens.TryGetTableIndex(parentHandle.Kind, out var parentTableIndex); 1122var deletedParentHandle = MetadataTokens.EntityHandle(parentTableIndex, 0); 1123var deletedMemberRefHandle = MetadataTokens.EntityHandle(TableIndex.MemberRef, 0); 1179entity: MetadataTokens.CustomAttributeHandle(rowId), 1208int typeRowId = MetadataTokens.GetRowNumber(GetTypeDefinitionHandle(member.ContainingTypeDefinition)); 1212entity: MetadataTokens.Handle(mapTable, mapRowId), 1217entity: MetadataTokens.Handle(table, index.GetRowId(member)), 1238entity: MetadataTokens.Handle(tableIndex, index.GetRowId(member)), 1256entity: MetadataTokens.MethodDefinitionHandle(_methodDefs.GetRowId(methodDef)), 1260entity: MetadataTokens.ParameterHandle(parameterFirstId + i), 1268paramEncMapRows.Add(MetadataTokens.GetRowNumber(param)); 1282entity: MetadataTokens.Handle(tableIndex, index.GetRowId(member)), 1297entity: MetadataTokens.Handle(tableIndex, firstRowId + i), 1464tokens.Add(MetadataTokens.Handle(tableIndex, firstRowId + i)); 1473tokens.Add(MetadataTokens.Handle(tableIndex, index.GetRowId(member))); 1481tokens.Add(MetadataTokens.Handle(tableIndex, row)); 1490declaringType: MetadataTokens.TypeDefinitionHandle(typeId), 1491eventList: MetadataTokens.EventDefinitionHandle(_eventMap.GetRowId(typeId))); 1500declaringType: MetadataTokens.TypeDefinitionHandle(typeId), 1501propertyList: MetadataTokens.PropertyDefinitionHandle(_propertyMap.GetRowId(typeId))); 1674index = MetadataTokens.GetRowNumber(handle); 1686index = MetadataTokens.GetRowNumber(handle); 1698index = MetadataTokens.GetRowNumber(handle); 1706index = MetadataTokens.GetRowNumber(deletedHandle); 1717index = MetadataTokens.GetRowNumber(handle); 1729index = MetadataTokens.GetRowNumber(handle);
Emit\EditAndContinue\EmitBaseline.cs (5)
65private static readonly ImmutableArray<int> s_emptyTableSizes = ImmutableArray.Create(new int[MetadataTokens.TableCount]); 337Debug.Assert(tableEntriesAdded.Length == MetadataTokens.TableCount); 491var sizes = new int[MetadataTokens.TableCount]; 537var methodImpl = reader.GetMethodImplementation(MetadataTokens.MethodImplementationHandle(row)); 543int methodDefRow = MetadataTokens.GetRowNumber(methodImpl.MethodBody);
MetadataReader\PEModule.cs (1)
2703int rid = MetadataTokens.GetRowNumber(typeDef);
NativePdbWriter\PdbWriter.cs (6)
100int methodToken = MetadataTokens.GetToken(methodHandle); 119UsingNamespace("@" + MetadataTokens.GetToken(_metadataWriter.GetMethodHandle(forwardToMethod)), methodBody.MethodDefinition); 136MetadataTokens.GetToken(_metadataWriter.GetMethodHandle(asyncMoveNextInfo.KickoffMethod)), 511MetadataTokens.GetToken(signatureHandle)); 525localSignatureHandleOpt.IsNil ? 0 : MetadataTokens.GetToken(localSignatureHandleOpt)); 729int token = MetadataTokens.GetToken(_metadataWriter.GetDefinitionHandle(definition.Definition));
NativePdbWriter\SymWriterMetadataProvider.cs (2)
74declaringTypeToken = MetadataTokens.GetToken(_writer.GetTypeHandle(m.GetContainingType(_writer.Context))); 87enclosingTypeToken = MetadataTokens.GetToken(_writer.GetTypeHandle(nt.GetContainingType(_writer.Context)));
PEWriter\FullMetadataWriter.cs (21)
132handle = MetadataTokens.TypeDefinitionHandle(index); 138return MetadataTokens.TypeDefinitionHandle(_typeDefs[def]); 143return _typeDefs[MetadataTokens.GetRowNumber(handle)]; 153return MetadataTokens.EventDefinitionHandle(_eventDefs[def]); 163return MetadataTokens.FieldDefinitionHandle(_fieldDefs[def]); 175handle = MetadataTokens.MethodDefinitionHandle(index); 181return MetadataTokens.MethodDefinitionHandle(_methodDefs[def]); 186return _methodDefs[MetadataTokens.GetRowNumber(handle)]; 196return MetadataTokens.PropertyDefinitionHandle(_propertyDefs[def]); 206return MetadataTokens.ParameterHandle(_parameterDefs[def]); 221return MetadataTokens.FieldDefinitionHandle(_fieldDefIndex[typeDef]); 226return MetadataTokens.MethodDefinitionHandle(_methodDefIndex[typeDef]); 231return MetadataTokens.ParameterHandle(_parameterListIndex[methodDef]); 236return MetadataTokens.AssemblyReferenceHandle(_assemblyRefIndex.GetOrAdd(reference.Identity)); 246return MetadataTokens.ModuleReferenceHandle(_moduleRefIndex.GetOrAdd(reference)); 256return MetadataTokens.MemberReferenceHandle(_memberRefIndex.GetOrAdd(reference)); 266return MetadataTokens.MethodSpecificationHandle(_methodSpecIndex.GetOrAdd(reference)); 280handle = MetadataTokens.TypeReferenceHandle(index); 286return MetadataTokens.TypeReferenceHandle(_typeRefIndex.GetOrAdd(reference)); 296return MetadataTokens.TypeSpecificationHandle(_typeSpecIndex.GetOrAdd(reference)); 306return MetadataTokens.StandaloneSignatureHandle(_standAloneSignatureIndex.GetOrAdd(blobIndex));
PEWriter\MetadataWriter.cs (13)
851return MetadataTokens.AssemblyFileHandle(index); 856return MetadataTokens.AssemblyFileHandle(_fileRefIndex[mref.Name]); 1634return GetTypeDef(MetadataTokens.TypeDefinitionHandle(token)); 1640return GetMethodDef(MetadataTokens.MethodDefinitionHandle(token)); 1646return GetTypeDef(MetadataTokens.TypeDefinitionHandle(token)).AsNestedTypeReference; 2121var parentHandle = MetadataTokens.Handle(tableIndex, parentRowId++); 2271implementation = MetadataTokens.ExportedTypeHandle(exportedType.ParentIndex + 1); 2284typeDefinitionId: exportedType.IsForwarder ? 0 : MetadataTokens.GetToken(exportedType.Type.TypeDef)); 3034var aggregateMethodRid = MetadataTokens.GetRowNumber(GetMethodDefinitionHandle(method)); 3325token = MetadataTokens.GetRowNumber(handle); 3333token = MetadataTokens.GetRowNumber(handle) + LiftedVariableBaseIndex; 3351writer.WriteInt32(token == 0 ? MetadataTokens.GetToken(ResolveEntityHandleFromPseudoToken(pseudoToken)) : token); 3384writer.WriteInt32(MetadataTokens.GetToken(handle));
PEWriter\MetadataWriter.DynamicAnalysis.cs (8)
87index = MetadataTokens.BlobHandle(_blobHeapSize); 114result = MetadataTokens.GuidHandle((_guidWriter.Count >> 4) + 1); 245writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(partIndex)); 311int heapOffset = MetadataTokens.GetHeapOffset(entry.Value); 345writer.WriteReference(MetadataTokens.GetHeapOffset(row.Name), isSmall: (sizes.BlobIndexSize == 2)); 346writer.WriteReference(MetadataTokens.GetHeapOffset(row.HashAlgorithm), isSmall: (sizes.GuidIndexSize == 2)); 347writer.WriteReference(MetadataTokens.GetHeapOffset(row.Hash), isSmall: (sizes.BlobIndexSize == 2)); 355writer.WriteReference(MetadataTokens.GetHeapOffset(row.Spans), isSmall: (sizes.BlobIndexSize == 2));
PEWriter\MetadataWriter.PortablePdb.cs (19)
68var methodHandle = MetadataTokens.MethodDefinitionHandle(methodRid); 165MetadataTokens.LocalVariableHandle(MetadataTokens.GetRowNumber(handle) + 1); 168MetadataTokens.LocalConstantHandle(MetadataTokens.GetRowNumber(handle) + 1); 322private static readonly ImportScopeHandle ModuleImportScopeHandle = MetadataTokens.ImportScopeHandle(1); 328writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(alias.Name))); 329writer.WriteCompressedInteger(MetadataTokens.GetRowNumber(GetOrAddAssemblyReferenceHandle(alias.Assembly))); 342writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(import.AliasOpt))); 343writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(import.TargetXmlNamespaceOpt))); 354writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(import.AliasOpt))); 372writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(import.AliasOpt))); 380writer.WriteCompressedInteger(MetadataTokens.GetRowNumber(GetAssemblyReferenceHandle(import.TargetAssemblyOpt))); 388writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(import.AliasOpt))); 399writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(namespaceName))); 408writer.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_debugMetadataOpt.GetOrAddBlobUTF8(import.AliasOpt))); 644writer.WriteCompressedInteger(MetadataTokens.GetRowNumber(localSignatureHandleOpt)); 662writer.WriteCompressedInteger(MetadataTokens.GetRowNumber(documentHandle)); 1025builder.WriteCompressedInteger(MetadataTokens.GetRowNumber(handle));
PEWriter\PeWriter.cs (1)
127nativePdbWriterOpt?.SetEntryPoint(MetadataTokens.GetToken(debugEntryPointHandle));
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (2)
72(mh, builder) => builder.WriteInt32(MetadataTokens.GetToken(mh))); 80(mh, builder) => builder.WriteInt32(MetadataTokens.GetToken(mh)));
Microsoft.CodeAnalysis.CSharp (8)
Symbols\Metadata\PE\PEAssemblySymbol.cs (1)
130return MetadataTokens.GetToken(_assembly.Handle);
Symbols\Metadata\PE\PEEventSymbol.cs (1)
243get { return MetadataTokens.GetToken(_handle); }
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
210get { return MetadataTokens.GetToken(_handle); }
Symbols\Metadata\PE\PEMethodSymbol.cs (1)
470public override int MetadataToken => MetadataTokens.GetToken(_handle);
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
643get { return MetadataTokens.GetToken(_handle); }
Symbols\Metadata\PE\PEParameterSymbol.cs (1)
496get { return MetadataTokens.GetToken(_handle); }
Symbols\Metadata\PE\PEPropertySymbol.cs (1)
461get { return MetadataTokens.GetToken(_handle); }
Symbols\Metadata\PE\PETypeParameterSymbol.cs (1)
127get { return MetadataTokens.GetToken(_handle); }
Microsoft.CodeAnalysis.Features (11)
EditAndContinue\EditAndContinueDebugInfoReader.cs (3)
62var symMethod = (ISymUnmanagedMethod2)_symReader.GetMethodByVersion(MetadataTokens.GetToken(methodHandle), _version); 65return symMethod == null ? default : MetadataTokens.StandaloneSignatureHandle(symMethod.GetLocalSignatureToken()); 70var methodToken = MetadataTokens.GetToken(methodHandle);
EditAndContinue\EditSession.cs (3)
138var highestEmittedTypeDefRow = emitResult.ChangedTypes.Max(t => MetadataTokens.GetRowNumber(t)); 1446var updatedMethodTokens = emitResult.UpdatedMethods.SelectAsArray(h => MetadataTokens.GetToken(h)); 1447var changedTypeTokens = emitResult.ChangedTypes.SelectAsArray(h => MetadataTokens.GetToken(h));
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (2)
112var handle = MetadataTokens.EntityHandle(symbolToFind.MetadataToken); 161handle = MetadataTokens.EntityHandle(newSymbol.MetadataToken);
PdbSourceDocument\SymbolSourceDocumentFinder.cs (1)
162docList.Add(MetadataTokens.DocumentHandle(reader.ReadCompressedInteger()));
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (2)
72(mh, builder) => builder.WriteInt32(MetadataTokens.GetToken(mh))); 80(mh, builder) => builder.WriteInt32(MetadataTokens.GetToken(mh)));
Microsoft.CodeAnalysis.VisualBasic (8)
Symbols\Metadata\PE\PEAssemblySymbol.vb (1)
146Return MetadataTokens.GetToken(_assembly.Handle)
Symbols\Metadata\PE\PEEventSymbol.vb (1)
137Return MetadataTokens.GetToken(_handle)
Symbols\Metadata\PE\PEFieldSymbol.vb (1)
80Return MetadataTokens.GetToken(_handle)
Symbols\Metadata\PE\PEMethodSymbol.vb (1)
323Return MetadataTokens.GetToken(_handle)
Symbols\Metadata\PE\PENamedTypeSymbol.vb (1)
247Return MetadataTokens.GetToken(_handle)
Symbols\Metadata\PE\PEParameterSymbol.vb (1)
290Return MetadataTokens.GetToken(_handle)
Symbols\Metadata\PE\PEPropertySymbol.vb (1)
163Return MetadataTokens.GetToken(_handle)
Symbols\Metadata\PE\PETypeParameterSymbol.vb (1)
122Return MetadataTokens.GetToken(_handle)
Microsoft.Diagnostics.DataContractReader.Contracts (11)
Contracts\Loader_1.cs (1)
630MethodDefinition methodDef = mdReader.GetMethodDefinition(MetadataTokens.MethodDefinitionHandle(token));
Contracts\ManagedTypeSource_1.cs (1)
268int token = MetadataTokens.GetToken((EntityHandle)typeDefHandle);
Contracts\RuntimeTypeSystem_1.cs (4)
1406MethodDefinitionHandle methodDefHandle = MetadataTokens.MethodDefinitionHandle((int)EcmaMetadataUtils.GetRowId(token)); 2038EntityHandle entityHandle = MetadataTokens.EntityHandle((int)typeDefToken); 2056uint fieldDefToken = (uint)MetadataTokens.GetToken(fieldDefHandle); 2117FieldDefinitionHandle fieldHandle = (FieldDefinitionHandle)MetadataTokens.Handle((int)token);
Contracts\Signature\SignatureTypeProvider.cs (2)
76int token = MetadataTokens.GetToken((EntityHandle)handle); 84int token = MetadataTokens.GetToken((EntityHandle)handle);
Contracts\StackWalk\GC\GcScanner.cs (1)
368MethodDefinitionHandle methodDefHandle = MetadataTokens.MethodDefinitionHandle((int)EcmaMetadataUtils.GetRowId(methodToken));
Contracts\StackWalk\GC\GcSignatureTypeProvider.cs (2)
70=> ClassifyTokenLookup(_target.Contracts.Loader.GetLookupTables(_moduleHandle).TypeDefToMethodTable, MetadataTokens.GetToken(handle), rawTypeKind); 73=> ClassifyTokenLookup(_target.Contracts.Loader.GetLookupTables(_moduleHandle).TypeRefToMethodTable, MetadataTokens.GetToken(handle), rawTypeKind);
Microsoft.Diagnostics.DataContractReader.Legacy (64)
ClrDataFrame.cs (2)
427MethodDefinitionHandle methodDefHandle = MetadataTokens.MethodDefinitionHandle((int)token); 546StandaloneSignatureHandle localSigHandle = MetadataTokens.StandaloneSignatureHandle(localToken);
ClrDataMethodDefinition.cs (1)
76MethodDefinitionHandle methodDefHandle = MetadataTokens.MethodDefinitionHandle(rowId);
ClrDataModule.cs (1)
191yield return (uint)MetadataTokens.GetToken(mh);
Dbi\DacDbiImpl.cs (2)
1751MethodDefinitionHandle mdMethodHandle = MetadataTokens.MethodDefinitionHandle((int)EcmaMetadataUtils.GetRowId(functionToken)); 3630FieldDefinitionHandle fieldDefHandle = (FieldDefinitionHandle)MetadataTokens.Handle((int)memberDef);
MetaDataImportImpl.cs (48)
174tokens.Add((uint)MetadataTokens.GetToken(h)); 218TypeDefinitionHandle typeHandle = MetadataTokens.TypeDefinitionHandle(GetRID(td)); 222tokens.Add((uint)MetadataTokens.GetToken(h)); 272TypeDefinitionHandle typeHandle = MetadataTokens.TypeDefinitionHandle(GetRID(cl)); 276tokens.Add((uint)MetadataTokens.GetToken(h)); 320TypeDefinitionHandle typeHandle = MetadataTokens.TypeDefinitionHandle(GetRID(cl)); 324tokens.Add((uint)MetadataTokens.GetToken(h)); 371EntityHandle owner = MetadataTokens.EntityHandle((int)tk); 385tokens.Add((uint)MetadataTokens.GetToken(h)); 422TypeDefinitionHandle typeHandle = MetadataTokens.TypeDefinitionHandle(GetRID(td)); 434*ptkExtends = baseType.IsNil ? 0 : (uint)MetadataTokens.GetToken(baseType); 476TypeReferenceHandle refHandle = MetadataTokens.TypeReferenceHandle(GetRID(tr)); 485*ptkResolutionScope = scope.IsNil ? 0 : (uint)MetadataTokens.GetToken(scope); 526MethodDefinitionHandle methodHandle = MetadataTokens.MethodDefinitionHandle(GetRID(mb)); 533*pClass = MapGlobalParentToken((uint)MetadataTokens.GetToken(methodDef.GetDeclaringType())); 604FieldDefinitionHandle fieldHandle = MetadataTokens.FieldDefinitionHandle(GetRID(mb)); 611*pClass = MapGlobalParentToken((uint)MetadataTokens.GetToken(fieldDef.GetDeclaringType())); 730InterfaceImplementationHandle implHandle = MetadataTokens.InterfaceImplementationHandle(GetRID(iiImpl)); 741*ptkIface = (uint)MetadataTokens.GetToken(impl.Interface); 773TypeDefinitionHandle typeHandle = MetadataTokens.TypeDefinitionHandle(GetRID(tdNestedClass)); 778*ptdEnclosingClass = declaringType.IsNil ? 0 : (uint)MetadataTokens.GetToken(declaringType); 806GenericParameterHandle gpHandle = MetadataTokens.GenericParameterHandle(GetRID(gp)); 816*ptOwner = (uint)MetadataTokens.GetToken(genericParam.Parent); 868MethodDefinitionHandle methodHandle = MetadataTokens.MethodDefinitionHandle(GetRID(tk)); 877FieldDefinitionHandle fieldHandle = MetadataTokens.FieldDefinitionHandle(GetRID(tk)); 917StandaloneSignatureHandle sigHandle = MetadataTokens.StandaloneSignatureHandle(GetRID(mdSig)); 963EntityHandle parent = MetadataTokens.EntityHandle((int)tkObj); 1079if (declaringType.IsNil || (uint)MetadataTokens.GetToken(declaringType) != tkEnclosingClass) 1084*ptd = (uint)MetadataTokens.GetToken(tdh); 1159MemberReferenceHandle refHandle = MetadataTokens.MemberReferenceHandle(GetRID(mr)); 1166*ptk = MapGlobalParentToken((uint)MetadataTokens.GetToken(memberRef.Parent)); 1236TypeDefinitionHandle typeHandle = MetadataTokens.TypeDefinitionHandle(GetRID(td)); 1261fieldOffsets[count * 2] = (uint)MetadataTokens.GetToken(fh); 1310ModuleReferenceHandle modRefHandle = MetadataTokens.ModuleReferenceHandle(GetRID(mur)); 1354TypeSpecificationHandle tsHandle = MetadataTokens.TypeSpecificationHandle(GetRID(typespec)); 1493MethodDefinitionHandle methodHandle = MetadataTokens.MethodDefinitionHandle(GetRID(md)); 1503*ppd = (uint)MetadataTokens.GetToken(ph); 1548ParameterHandle paramHandle = MetadataTokens.ParameterHandle(GetRID(tk)); 1557*pmd = _paramToMethod.TryGetValue(MetadataTokens.GetRowNumber(paramHandle), out uint methodToken) ? methodToken : 0; 1767AssemblyReferenceHandle refHandle = MetadataTokens.AssemblyReferenceHandle(GetRID(mdar)); 1883ExportedTypeHandle handle = MetadataTokens.ExportedTypeHandle(GetRID(mdct)); 1894*ptkImplementation = impl.IsNil ? 0 : (uint)MetadataTokens.GetToken(impl); 2002if (impl.IsNil || (uint)MetadataTokens.GetToken(impl) != mdtExportedType) 2007*ptkExportedType = (uint)MetadataTokens.GetToken(eth); 2086uint typeToken = (uint)MetadataTokens.GetToken(tdh); 2089lookup[MetadataTokens.GetRowNumber(ih)] = typeToken; 2102uint methodToken = (uint)MetadataTokens.GetToken(mdh); 2105lookup[MetadataTokens.GetRowNumber(ph)] = methodToken;
SigFormat.cs (3)
185TypeDefinition internalTypeDef = internalTypeMetadata.GetTypeDefinition((TypeDefinitionHandle)MetadataTokens.Handle((int)typeDefToken)); 350TypeDefinition typeDef = metadata.GetTypeDefinition((TypeDefinitionHandle)MetadataTokens.Handle((int)typeDefToken)); 395GenericParameter genericVariable = generatedVariableMetadata.GetGenericParameter((GenericParameterHandle)MetadataTokens.Handle((int)typeVarToken));
SOSDacImpl.cs (2)
1090FieldDefinitionHandle fieldHandle = (FieldDefinitionHandle)MetadataTokens.Handle((int)token); 1153data->TokenOfType = (uint)MetadataTokens.GetToken(entityHandle);
TypeNameBuilder.cs (5)
125MethodDefinition methodDef = reader.GetMethodDefinition(MetadataTokens.MethodDefinitionHandle((int)runtimeTypeSystem.GetMethodToken(method))); 144MethodDefinition methodDef = reader.GetMethodDefinition(MetadataTokens.MethodDefinitionHandle((int)runtimeTypeSystem.GetMethodToken(method))); 232var handle = (GenericParameterHandle)MetadataTokens.Handle((int)genericParamToken); 285if (MetadataTokens.EntityHandle((int)typeDefToken).IsNil) 299AppendNestedTypeDef(ref tnb, reader, (TypeDefinitionHandle)MetadataTokens.EntityHandle((int)typeDefToken), format);
Microsoft.DotNet.Build.Tasks.Packaging (1)
GetAssemblyReferences.cs (1)
71var moduleRef = reader.GetModuleReference(MetadataTokens.ModuleReferenceHandle(i));
Microsoft.DotNet.PackageTesting (2)
VerifyClosure.cs (2)
462var reference = reader.GetAssemblyReference(MetadataTokens.AssemblyReferenceHandle(i + 1)); 476var moduleRef = reader.GetModuleReference(MetadataTokens.ModuleReferenceHandle(i + 1));
Microsoft.DotNet.SharedFramework.Sdk (2)
src\arcade\src\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (2)
462var reference = reader.GetAssemblyReference(MetadataTokens.AssemblyReferenceHandle(i + 1)); 476var moduleRef = reader.GetModuleReference(MetadataTokens.ModuleReferenceHandle(i + 1));
Microsoft.VisualStudio.TestPlatform.ObjectModel (1)
Navigation\PortablePdbReader.cs (1)
118var handle = ((MethodDefinitionHandle)MetadataTokens.Handle(methodToken)).ToDebugInformationHandle();
System.Diagnostics.StackTrace (1)
System\Diagnostics\StackTraceSymbols.cs (1)
61Handle handle = MetadataTokens.Handle(methodToken);
System.Reflection.Emit (37)
System\Reflection\Emit\FieldBuilderImpl.cs (1)
89public override int MetadataToken => _handle == default ? 0 : MetadataTokens.GetToken(_handle);
System\Reflection\Emit\ILGeneratorImpl.cs (1)
474_il.Token(MetadataTokens.GetToken(handle));
System\Reflection\Emit\MethodBuilderImpl.cs (1)
247public override int MetadataToken => _handle == default ? 0 : MetadataTokens.GetToken(_handle);
System\Reflection\Emit\ModuleBuilderImpl.cs (32)
133fieldList: MetadataTokens.FieldDefinitionHandle(1), 134methodList: MetadataTokens.MethodDefinitionHandle(1)); 307field._handle = MetadataTokens.FieldDefinitionHandle(_nextFieldDefRowId++); 315method._handle = MetadataTokens.MethodDefinitionHandle(_nextMethodDefRowId++); 323property._handle = MetadataTokens.PropertyDefinitionHandle(_nextPropertyRowId++); 331eventBuilder._handle = MetadataTokens.EventDefinitionHandle(_nextEventRowId++); 339typeBuilder._handle = MetadataTokens.TypeDefinitionHandle(++_nextTypeDefRowId); 435spBlobBuilder.WriteCompressedInteger(MetadataTokens.GetRowNumber(localSignatureHandle)); 444AddLocalScope(methodHandle, parentImport: default, MetadataTokens.LocalVariableHandle(_pdbBuilder.GetRowCount(TableIndex.LocalVariable) + 1), scope); 456spBlobBuilder.WriteCompressedInteger(MetadataTokens.GetRowNumber(localSignature)); 457spBlobBuilder.WriteCompressedInteger(MetadataTokens.GetRowNumber(GetDocument(pair.Key))); 466spBlobBuilder.WriteCompressedInteger(MetadataTokens.GetRowNumber(GetDocument(pair.Key))); 519constantList: MetadataTokens.LocalConstantHandle(1), scope._startOffset, scope._endOffset - scope._startOffset); 525AddLocalScope(methodHandle, parentImport, MetadataTokens.LocalVariableHandle(_pdbBuilder.GetRowCount(TableIndex.LocalVariable) + 1), childScope); 565importBlob.WriteCompressedInteger(MetadataTokens.GetHeapOffset(_pdbBuilder.GetOrAddBlobUTF8(importNs))); 616pair.Value.WriteInt32(MetadataTokens.GetToken(GetMemberHandle(member))); 621pair.Value.WriteInt32(MetadataTokens.GetToken(GetMethodReference(pair2.Key, pair2.Value))); 911eventList: MetadataTokens.EventDefinitionHandle(firstEventToken)); 916propertyList: MetadataTokens.PropertyDefinitionHandle(firstPropertyToken)); 930fieldList: MetadataTokens.FieldDefinitionHandle(fieldToken), 931methodList: MetadataTokens.MethodDefinitionHandle(methodToken)); 940parameterList: MetadataTokens.ParameterHandle(parameterToken)); 1080return MetadataTokens.GetToken(handle); 1233public override int GetStringMetadataToken(string stringConstant) => MetadataTokens.GetToken(_metadataBuilder.GetOrAddUserString(stringConstant)); 1272method._handle = MetadataTokens.MethodDefinitionHandle(_nextMethodDefRowId++); 1284field._handle = MetadataTokens.FieldDefinitionHandle(_nextFieldDefRowId++); 1300method._handle = MetadataTokens.MethodDefinitionHandle(_nextMethodDefRowId++); 1320field._handle = MetadataTokens.FieldDefinitionHandle(_nextFieldDefRowId++); 1365MetadataTokens.GetToken(_metadataBuilder.AddStandaloneSignature(_metadataBuilder.GetOrAddBlob(signature.GetSignature()))); 1368MetadataTokens.GetToken(_metadataBuilder.AddStandaloneSignature( 1373MetadataTokens.GetToken(_metadataBuilder.AddStandaloneSignature(_metadataBuilder.GetOrAddBlob( 1384return MetadataTokens.GetToken(_metadataBuilder.AddStandaloneSignature(_metadataBuilder.GetOrAddBlob(blob)));
System\Reflection\Emit\TypeBuilderImpl.cs (2)
49_handle = MetadataTokens.TypeDefinitionHandle(1); 628public override int MetadataToken => MetadataTokens.GetToken(_handle);
System.Reflection.Metadata (45)
System\Reflection\Metadata\Ecma335\Encoding\ControlFlowBuilder.cs (1)
387ExceptionRegionKind.Catch => MetadataTokens.GetToken(handler.CatchType),
System\Reflection\Metadata\Ecma335\Encoding\ExceptionRegionEncoder.cs (1)
241catchTokenOrOffset = MetadataTokens.GetToken(catchType);
System\Reflection\Metadata\Ecma335\Encoding\InstructionEncoder.cs (2)
73Token(MetadataTokens.GetToken(handle)); 91Token(MetadataTokens.GetToken(handle));
System\Reflection\Metadata\Ecma335\Encoding\MethodBodyStreamEncoder.cs (1)
266Builder.WriteInt32(localVariablesSignature.IsNil ? 0 : MetadataTokens.GetToken(localVariablesSignature));
System\Reflection\Metadata\Ecma335\MetadataAggregator.cs (8)
72if (baseTableRowCounts.Count != MetadataTokens.TableCount) 74throw new ArgumentException(SR.Format(SR.ExpectedListOfSize, MetadataTokens.TableCount), nameof(baseTableRowCounts)); 82if (baseHeapSizes.Count != MetadataTokens.HeapCount) 84throw new ArgumentException(SR.Format(SR.ExpectedListOfSize, MetadataTokens.HeapCount), nameof(baseTableRowCounts)); 117int[] rowCounts = new int[MetadataTokens.TableCount]; 118int[] heapSizes = new int[MetadataTokens.HeapCount]; 196var rowCounts = new RowCounts[MetadataTokens.TableCount][]; 262MetadataTokens.TryGetHeapIndex(handle.Kind, out heapIndex);
System\Reflection\Metadata\Ecma335\MetadataBuilder.Tables.cs (8)
292/// An array of size <see cref="MetadataTokens.TableCount"/> with each item filled with the current row count of the corresponding table. 296var rowCounts = ImmutableArray.CreateBuilder<int>(MetadataTokens.TableCount); 297rowCounts.Count = MetadataTokens.TableCount; 453/// If no type defines any fields in the module, <see cref="MetadataTokens.FieldDefinitionHandle(int)"/>(1). 457/// If no type defines any methods in the module, <see cref="MetadataTokens.MethodDefinitionHandle(int)"/>(1). 982/// If no parameters are declared in the module, <see cref="MetadataTokens.ParameterHandle(int)"/>(1). 1262/// If no scope defines any variables, <see cref="MetadataTokens.LocalVariableHandle(int)"/>(1). 1266/// If no scope defines any constants, <see cref="MetadataTokens.LocalConstantHandle(int)"/>(1).
System\Reflection\Metadata\Ecma335\MetadataReaderExtensions.cs (1)
27if ((int)tableIndex >= MetadataTokens.TableCount)
System\Reflection\Metadata\Ecma335\MetadataRootBuilder.cs (1)
21internal static readonly ImmutableArray<int> EmptyRowCounts = ImmutableArray.Create(new int[MetadataTokens.TableCount]);
System\Reflection\Metadata\Ecma335\MetadataSizes.cs (3)
128Debug.Assert(rowCounts.Length == MetadataTokens.TableCount); 129Debug.Assert(externalRowCounts.Length == MetadataTokens.TableCount); 130Debug.Assert(heapSizes.Length == MetadataTokens.HeapCount);
System\Reflection\Metadata\Ecma335\PortablePdbBuilder.cs (4)
36/// The length of the array must be equal to <see cref="MetadataTokens.TableCount"/>. 77if (typeSystemRowCounts.Length != MetadataTokens.TableCount) 79throw new ArgumentException(SR.Format(SR.ExpectedArrayOfSize, MetadataTokens.TableCount), nameof(typeSystemRowCounts)); 111builder.WriteInt32(_entryPoint.IsNil ? 0 : MetadataTokens.GetToken(_entryPoint));
System\Reflection\Metadata\MetadataReader.cs (2)
496var rowCounts = new int[MetadataTokens.TableCount]; 812for (int tableIndex = 0; tableIndex < MetadataTokens.TableCount; tableIndex++)
System\Reflection\Metadata\PortablePdb\ImportDefinitionCollection.cs (12)
69typeOrNamespace: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger())); 76assembly: MetadataTokens.AssemblyReferenceHandle(_reader.ReadCompressedInteger()), 77typeOrNamespace: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger())); 84alias: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger())); 91alias: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger()), 92assembly: MetadataTokens.AssemblyReferenceHandle(_reader.ReadCompressedInteger())); 99alias: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger()), 108alias: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger()), 109typeOrNamespace: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger())); 116alias: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger()), 117assembly: MetadataTokens.AssemblyReferenceHandle(_reader.ReadCompressedInteger()), 118typeOrNamespace: MetadataTokens.BlobHandle(_reader.ReadCompressedInteger()));
System\Reflection\PortableExecutable\ManagedPEBuilder.cs (1)
166_entryPointOpt.IsNil ? 0 : MetadataTokens.GetToken(_entryPointOpt),
System.Reflection.MetadataLoadContext (18)
System\Reflection\TypeLoading\General\Ecma\MetadataExtensions.cs (18)
59public static int GetToken(this Handle handle) => MetadataTokens.GetToken(handle); 60public static int GetToken(this EntityHandle handle) => MetadataTokens.GetToken(handle); 61public static int GetToken(this TypeDefinitionHandle handle) => MetadataTokens.GetToken(handle); 62public static int GetToken(this TypeReferenceHandle handle) => MetadataTokens.GetToken(handle); 63public static int GetToken(this TypeSpecificationHandle handle) => MetadataTokens.GetToken(handle); 64public static int GetToken(this GenericParameterHandle handle) => MetadataTokens.GetToken(handle); 65public static int GetToken(this GenericParameterConstraintHandle handle) => MetadataTokens.GetToken(handle); 66public static int GetToken(this FieldDefinitionHandle handle) => MetadataTokens.GetToken(handle); 67public static int GetToken(this EventDefinitionHandle handle) => MetadataTokens.GetToken(handle); 68public static int GetToken(this MethodDefinitionHandle handle) => MetadataTokens.GetToken(handle); 69public static int GetToken(this PropertyDefinitionHandle handle) => MetadataTokens.GetToken(handle); 70public static int GetToken(this ParameterHandle handle) => MetadataTokens.GetToken(handle); 71public static int GetToken(this StandaloneSignatureHandle handle) => MetadataTokens.GetToken(handle); 72public static int GetToken(this AssemblyFileHandle handle) => MetadataTokens.GetToken(handle); 91public static Handle ToHandle(this int token) => MetadataTokens.Handle(token); 92public static TypeDefinitionHandle ToTypeDefinitionHandle(this int token) => MetadataTokens.TypeDefinitionHandle(token); 93public static TypeReferenceHandle ToTypeReferenceHandle(this int token) => MetadataTokens.TypeReferenceHandle(token); 94public static TypeSpecificationHandle ToTypeSpecificationHandle(this int token) => MetadataTokens.TypeSpecificationHandle(token);