System.Reflection.Metadata Represents a disposable blob of memory accessed via unsafe pointer. Pointer to the underlying data (not valid after disposal). Returns the content of the memory block. Only creates a copy of the data if they are not represented by a managed byte array, or the offset is non-zero. Disposes the block. The operation is idempotent, but must not be called concurrently with any other operations on the block or with another call to Dispose. Using the block after dispose is an error in our code and therefore no effort is made to throw a tidy ObjectDisposedException and null ref or AV is possible. Represents a memory block backed by an array of bytes. Class representing raw memory but not owning the memory. Represents raw memory owned by an external object. Creates and hydrates a memory block representing all data. Error while reading from the memory source. Creates and hydrates a memory block representing data in the specified range. Starting offset relative to the beginning of the data represented by this provider. Size of the resulting block. Error while reading from the memory source. Gets a seekable and readable that can be used to read all data. The operations on the stream has to be done under a lock of if non-null. The image starts at and has size . It is the caller's responsibility not to read outside those bounds. The size of the data. Represents memory block allocated on native heap. Owns the native memory resource. Represents data read from a stream. Uses memory map to load data from streams backed by files that are bigger than . Error while reading from the stream. Provides helpers to decode strings from unmanaged memory to System.String while avoiding intermediate allocation. This has three components: (1) Light-up Encoding.GetString(byte*, int) via reflection and resurface it as extension method. This is a new API that will provide API convergence across all platforms for this scenario. It is already on .NET 4.6+ and ASP.NET vNext, but not yet available on every platform we support. See below for how we fall back. (2) Deal with WinRT prefixes. When reading managed winmds with projections enabled, the metadata reader needs to prepend a WinRT prefix in some case . Doing this without allocation poses a problem as we don't have the prefix and input in contiguous data that we can pass to the Encoding.GetString. We handle this case using pooled managed scratch buffers where we copy the prefix and input and decode using Encoding.GetString(byte[], int, int). (3) Deal with platforms that don't yet have Encoding.GetString(byte*, int). If we're running on a full framework earlier than 4.6, we will bind to the internal String.CreateStringFromEncoding which is equivalent and Encoding.GetString is just a trivial wrapper around it in .NET 4.6. This means that we always have the fast path on every full framework version we support. If we can't bind to it via reflection, then we emulate it using what is effectively (2) and with an empty prefix. For both (2) and (3), the pooled buffers have a fixed size deemed large enough for the vast majority of metadata strings. In the rare worst case (byteCount > threshold and (lightUpAttemptFailed || prefix != null), we give up and allocate a temporary array, copy to it, decode, and throw it away. The offset bias value used in the FNV-1a algorithm See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function The generative factor used in the FNV-1a algorithm See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function Compute the FNV-1a hash of a sequence of bytes See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function The sequence of bytes The FNV-1a hash of Compute the FNV-1a hash of a sequence of bytes See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function The sequence of bytes The FNV-1a hash of Provides tools for using in interop scenarios. *** WARNING *** If you decide to copy this code elsewhere, please retain the documentation here and the Dangerous prefixes in the API names. This will help track down and audit other places where this technique (with dangerous consequences when misused) may be applied. A generic version of this API was once public in a pre-release of immutable collections, but it was deemed to be too subject to abuse when available publicly. This implementation is scoped to byte arrays as that is all that the metadata reader needs. Also, since we don't have access to immutable collection internals, we use a trick involving overlapping a with a refer. While unverifiable, it is valid. See ECMA-335, section II.10.7 Controlling instance layout: "It is possible to overlap fields in this way, though offsets occupied by an object reference shall not overlap with offsets occupied by a built-in value type or a part of another object reference. While one object reference can completely overlap another, this is unverifiable." Furthermore, the fact that backed by a single field is something inherent to the design of ImmutableArray in order to get its performance characteristics and therefore something we (Microsoft) are comfortable defining as a contract that can be depended upon as below. Creates a new instance of using a given mutable array as the backing field, without creating a defensive copy. It is the responsibility of the caller to ensure no other mutable references exist to the array. Do not mutate the array after calling this method. The mutable array to use as the backing field. The incoming reference is set to null since it should not be retained by the caller. Users of this method should take extra care to ensure that the mutable array given as a parameter is never modified. The returned will use the given array as its backing field without creating a defensive copy, so changes made to the given mutable array will be observable on the returned . Instance and static methods of and may malfunction if they operate on an instance whose underlying backing field is modified. An immutable array. Access the backing mutable array instance for the given , without creating a defensive copy. It is the responsibility of the caller to ensure the array is not modified through the returned mutable reference. Do not mutate the returned array. The from which to retrieve the backing field. Users of this method should take extra care to ensure that the returned mutable array is never modified. The returned mutable array continues to be used as the backing field of the given without creating a defensive copy, so changes made to the returned mutable array will be observable on the given . Instance and static methods of and may malfunction if they operate on an instance whose underlying backing field is modified. The underlying array, or null if is true. Decodes a compressed integer value starting at offset. See Metadata Specification section II.23.2: Blobs and signatures. Offset to the start of the compressed data. Bytes actually read. Value between 0 and 0x1fffffff, or if the value encoding is invalid. Read UTF8 at the given offset up to the given terminator, null terminator, or end-of-block. Offset in to the block where the UTF8 bytes start. UTF8 encoded prefix to prepend to the bytes at the offset before decoding. The UTF8 decoder to use that allows user to adjust fallback and/or reuse existing strings without allocating a new one. The number of bytes read, which includes the terminator if we did not hit the end of the block. A character in the ASCII range that marks the end of the string. If a value other than '\0' is passed we still stop at the null terminator if encountered first. The decoded string. Get number of bytes from offset to given terminator, null terminator, or end-of-block (whichever comes first). Returned length does not include the terminator, but numberOfBytesRead out parameter does. Offset in to the block where the UTF8 bytes start. A character in the ASCII range that marks the end of the string. If a value other than '\0' is passed we still stop at the null terminator if encountered first. The number of bytes read, which includes the terminator if we did not hit the end of the block. Length (byte count) not including terminator. In a table that specifies children via a list field (e.g. TypeDef.FieldList, TypeDef.MethodList), searches for the parent given a reference to a child. Returns row number [0..RowCount). In a table ordered by a column containing entity references searches for a row with the specified reference. Returns row number [0..RowCount) or -1 if not found. Calculates a range of rows that have specified value in the specified column in a table that is sorted by that column. Calculates a range of rows that have specified value in the specified column in a table that is sorted by that column. The usage is: var inst = PooledStringBuilder.GetInstance(); var sb = inst.builder; ... Do Stuff... ... sb.ToString() ... inst.Free(); Generic implementation of object pooling pattern with predefined pool size limit. The main purpose is that limited number of frequently used objects can be kept in the pool for further recycling. Notes: 1) it is not the goal to keep all returned objects. Pool is not meant for storage. If there is no space in the pool, extra returned objects will be dropped. 2) it is implied that if object was obtained from a pool, the caller will return it back in a relatively short time. Keeping checked out objects for long durations is ok, but reduces usefulness of pooling. Just new up your own. Not returning objects to the pool in not detrimental to the pool's work, but is a bad practice. Rationale: If there is no intent for reusing the object, do not use pool - just use "new". Produces an instance. Search strategy is a simple linear probing which is chosen for it cache-friendliness. Note that Free will try to store recycled objects close to the start thus statistically reducing how far we will typically search. Returns objects to the pool. Search strategy is a simple linear probing which is chosen for it cache-friendliness. Note that Free will try to store recycled objects close to the start thus statistically reducing how far we will typically search in Allocate. Copies specified amount of data from given stream to a target memory pointer. unexpected stream end. Attempts to read all of the requested bytes from the stream into the buffer The number of bytes read. Less than will only be returned if the end of stream is reached before all bytes can be read. Unlike it is not guaranteed that the stream position or the output buffer will be unchanged if an exception is returned. Resolve image size as either the given user-specified size or distance from current position to end-of-stream. Also performs the relevant argument validation and publicly visible caller has same argument names. size is 0 and distance from current position to end-of-stream can't fit in Int32. Size is negative or extends past the end-of-stream from current position. Decodes custom attribute blobs. Serialized #Pdb stream. Sets the capacity of the specified table. is not a valid table index. is negative. Use to reduce allocations if the approximate number of rows is known ahead of time. Adds a type definition. Attributes Namespace Type name , , or nil. If the type declares fields the handle of the first one, otherwise the handle of the first field declared by the next type definition. If no type defines any fields in the module the (1). If the type declares methods the handle of the first one, otherwise the handle of the first method declared by the next type definition. If no type defines any methods in the module the (1). doesn't have the expected handle kind. Adds an interface implementation to a type. The type implementing the interface. The interface being implemented: , or . doesn't have the expected handle kind. Add a type reference. The entity declaring the target type: , , or . Namespace. Type name. doesn't have the expected handle kind. Adds a property defintion. Attributes Name Signature of the property. Adds an event defintion. Attributes Name Type of the event: , , or doesn't have the expected handle kind. Adds a default value for a parameter, field or property. , , or The constant value. doesn't have the expected handle kind. Associates a method (a getter, a setter, an adder, etc.) with a property or an event. or . Semantics. Method definition. doesn't have the expected handle kind. Add a custom attribute. An entity to attach the custom attribute to: , , , , , , , , , , , , , , , , , , , , or . Custom attribute constructor: or Custom attribute value blob. doesn't have the expected handle kind. Adds a method specification (instantiation). Generic method: or Instantiation blob encoding the generic arguments of the method. doesn't have the expected handle kind. Adds a generic parameter definition. or Attributes. Parameter name. Zero-based parameter index. doesn't have the expected handle kind. Adds a type constraint to a generic parameter. Generic parameter to constrain. Type constraint: , or doesn't have the expected handle kind. Add marshalling information to a field or a parameter. or . Descriptor. doesn't have the expected handle kind. Adds import information to a method definition (P/Invoke). Method definition. Attributes Unmanaged method name. Module containing the unmanaged method. Defines an implementation for a method declaration within a type. Type or which provides the implementation. or the method being implemented. or doesn't have the expected handle kind. Adds a MemberRef table row. Containing entity: , , , , or . Member name. Member signature. doesn't have the expected handle kind. Adds a manifest resource. Attributes Resource name , , or nil Specifies the byte offset within the referenced file at which this resource record begins. doesn't have the expected handle kind. Adds an exported type. Attributes Namespace Type name , or Type definition id doesn't have the expected handle kind. Adds declarative security attribute to a type, method or an assembly. , , or Security action Permission set blob. doesn't have the expected handle kind. Add a custom debug information. An entity to attach the debug information to: , , , , , , , , , , , , , , , , , , , , , , , , , or . Information kind. Determines the structure of the blob. Custom debug information blob. doesn't have the expected handle kind. Creates a builder for metadata tables and heaps. Start offset of the User String heap. The cumulative size of User String heaps of all previous EnC generations. Should be 0 unless the metadata is EnC delta metadata. Start offset of the String heap. The cumulative size of String heaps of all previous EnC generations. Should be 0 unless the metadata is EnC delta metadata. Start offset of the Blob heap. The cumulative size of Blob heaps of all previous EnC generations. Should be 0 unless the metadata is EnC delta metadata. Start offset of the Guid heap. The cumulative size of Guid heaps of all previous EnC generations. Should be 0 unless the metadata is EnC delta metadata. Offset is too big. Offset is negative. is not a multiple of size of GUID. Sets the capacity of the specified table. Heap index. Number of bytes. is not a valid heap index. is negative. Use to reduce allocations if the approximate number of bytes is known ahead of time. Adds specified blob to Blob heap, if it's not there already. containing the blob. Handle to the added or existing blob. is null. Adds specified blob to Blob heap, if it's not there already. Array containing the blob. Handle to the added or existing blob. is null. Adds specified blob to Blob heap, if it's not there already. Array containing the blob. Handle to the added or existing blob. is null. Encodes a constant value to a blob and adds it to the Blob heap, if it's not there already. Uses UTF16 to encode string constants. Constant value. Handle to the added or existing blob. Encodes a string using UTF16 encoding to a blob and adds it to the Blob heap, if it's not there already. String. Handle to the added or existing blob. is null. Encodes a string using UTF8 encoding to a blob and adds it to the Blob heap, if it's not there already. Constant value. True to encode unpaired surrogates as specified, otherwise replace them with U+FFFD character. Handle to the added or existing blob. is null. Adds specified Guid to Guid heap, if it's not there already. Guid to add. Handle to the added or existing Guid. Reserves space on the Guid heap for a GUID. representing the GUID blob as stored on the heap. Handle to the reserved Guid. The remaining space on the heap is too small to fit the string. Adds specified string to String heap, if it's not there already. Array containing the blob. Handle to the added or existing blob. is null. Reserves space on the User String heap for a string of specified length. The number of characters to reserve. representing the entire User String blob (including its length and terminal character). Use to fill in the content. Handle to the reserved User String. May be used in . The remaining space on the heap is too small to fit the string. is negative. Adds specified string to User String heap, if it's not there already. String to add. Handle to the added or existing string. May be used in . The remaining space on the heap is too small to fit the string. is null. Fills in stringIndexMap with data from stringIndex and write to stringWriter. Releases stringIndex as the stringTable is sealed after this point. Sorts strings such that a string is followed immediately by all strings that are a suffix of it. is not in range [0, 0xffff]. is not in range [0, 0xffff]. is not in range [0, 0x1fffffff]. is not in range [0, 0x1fffffff]. Writes primitive type code. Any primitive type code except for and . is not valid in this context. Encodes a reference to a type. or . True to mark the type as value type, false to mark it as a reference type in the signature. doesn't have the expected handle kind. Starts a function pointer signature. Calling convention. Function pointer attributes. Generic parameter count. is invalid. is not in range [0, 0xffff]. Starts a generic instantiation signature. or . Generic argument count. True to mark the type as value type, false to mark it as a reference type in the signature. doesn't have the expected handle kind. is not in range [1, 0xffff]. Encodes a reference to type parameter of a containing generic method. Parameter index. is not in range [0, 0xffff]. Encodes a reference to type parameter of a containing generic type. Parameter index. is not in range [0, 0xffff]. Starts pointer signature. Encodes void*. Starts SZ array (vector) signature. Starts a signature of a type with custom modifiers. Exact (unaligned) heap sizes. Use to get an aligned heap size. Table row counts. External table row counts. Non-empty tables that are emitted into the metadata table stream. Non-empty tables stored in an external metadata table stream that might be referenced from the metadata table stream being emitted. Overall size of metadata stream storage (stream headers, table stream, heaps, additional streams). Aligned to . The size of metadata stream (#- or #~). Aligned. Aligned to . The size of #Pdb stream. Aligned. Metadata header size. Includes: - metadata storage signature - storage header - stream headers Total size of metadata (header and all streams). Returns aligned size of the specified heap. Decodes signature blobs. See Metadata Specification section II.23.2: Blobs and signatures. Creates a new SignatureDecoder. The provider used to obtain type symbols as the signature is decoded. The metadata reader from which the signature was obtained. It may be null if the given provider allows it. Decodes a type embedded in a signature and advances the reader past the type. The blob reader positioned at the leading SignatureTypeCode Allow a to follow a (CLASS | VALUETYPE) in the signature. At present, the only context where that would be valid is in a LocalConstantSig as defined by the Portable PDB specification. The decoded type. The reader was not positioned at a valid signature type. Decodes a list of types, with at least one instance that is preceded by its count as a compressed integer. Decodes a method (definition, reference, or standalone) or property signature blob. BlobReader positioned at a method signature. The decoded method signature. The method signature is invalid. Decodes a method specification signature blob and advances the reader past the signature. A BlobReader positioned at a valid method specification signature. The types used to instantiate a generic method via the method specification. Decodes a local variable signature blob and advances the reader past the signature. The blob reader positioned at a local variable signature. The local variable types. The local variable signature is invalid. Decodes a field signature blob and advances the reader past the signature. The blob reader positioned at a field signature. The decoded field type. Provides an extension method to access the TypeDefinitionId column of the ExportedType table. Gets a hint at the likely row number of the target type in the TypeDef table of its module. If the namespaces and names do not match, resolution falls back to a full search of the target TypeDef table. Ignored and should be zero if is true. Provides extension methods for working with certain raw elements of the ECMA-335 metadata tables and heaps. Returns the number of rows in the specified table. is null. is not a valid table index. Returns the size of a row in the specified table. is null. is not a valid table index. Returns the offset from the start of metadata to the specified table. is null. is not a valid table index. Returns the size of the specified heap. is null. is not a valid heap index. Returns the offset from the start of metadata to the specified heap. is null. is not a valid heap index. Returns the size of the specified heap. is null. is not a valid heap index. Returns the a handle to the UserString that follows the given one in the UserString heap or a nil handle if it is the last one. is null. Returns the a handle to the Blob that follows the given one in the Blob heap or a nil handle if it is the last one. is null. Returns the a handle to the String that follows the given one in the String heap or a nil handle if it is the last one. is null. Enumerates entries of EnC log. is null. Enumerates entries of EnC map. is null. Enumerate types that define one or more properties. The resulting sequence corresponds exactly to entries in PropertyMap table, i.e. n-th returned is stored in n-th row of PropertyMap. Enumerate types that define one or more events. The resulting sequence corresponds exactly to entries in EventMap table, i.e. n-th returned is stored in n-th row of EventMap. Given a type handle and a raw type kind found in a signature blob determines whether the target type is a value type or a reference type. Maximum number of tables that can be present in Ecma335 metadata. Maximum number of tables that can be present in Ecma335 metadata. Returns the row number of a metadata table entry that corresponds to the specified in the context of . One based row number. The is not a valid metadata table handle. Returns the offset of metadata heap data that corresponds to the specified in the context of . Zero based offset, or -1 if isn't a metadata heap handle. The operation is not supported for the specified . The is invalid. Returns the metadata token of the specified in the context of . Metadata token. The operation is not supported for the specified . Returns the metadata token of the specified in the context of . Metadata token. Handle represents a metadata entity that doesn't have a token. A token can only be retrieved for a metadata table handle or a heap handle of type . The operation is not supported for the specified . Returns the row number of a metadata table entry that corresponds to the specified . One based row number, or -1 if can only be interpreted in a context of a specific . See . Returns the offset of metadata heap data that corresponds to the specified . An offset in the corresponding heap, or -1 if can only be interpreted in a context of a specific or . See . Returns the offset of metadata heap data that corresponds to the specified . Zero based offset, or -1 if can only be interpreted in a context of a specific or . See . Returns the offset of metadata heap data that corresponds to the specified . Zero based offset, or -1 if can only be interpreted in a context of a specific or . See . Returns the offset of metadata heap data that corresponds to the specified . Zero based offset, or -1 if can only be interpreted in a context of a specific or . See . Returns the offset of metadata heap data that corresponds to the specified . Zero based offset, or -1 if can only be interpreted in a context of a specific or . See . Returns the metadata token of the specified . Metadata token, or 0 if can only be interpreted in a context of a specific . See . Handle represents a metadata entity that doesn't have a token. A token can only be retrieved for a metadata table handle or a heap handle of type . Returns the metadata token of the specified . Metadata token, or 0 if can only be interpreted in a context of a specific . See . Gets the of the table corresponding to the specified . Handle type. Table index. True if the handle type corresponds to an Ecma335 table, false otherwise. Gets the of the heap corresponding to the specified . Handle type. Heap index. True if the handle type corresponds to an Ecma335 heap, false otherwise. Creates a handle from a token value. is not a valid metadata token. It must encode a metadata table entity or an offset in heap. Creates an entity handle from a token value. is not a valid metadata entity token. Creates an from a token value. is not a valid table index. Creates an from a token value. is not a valid table index. Returns true if the given raw (non-virtual) handle represents the same string as given ASCII string. Returns the heap index of the given ASCII character or -1 if not found prior null terminator or end of heap. Returns true if the given raw (non-virtual) handle represents a string that starts with given ASCII prefix. Equivalent to Array.BinarySearch, searches for given raw (non-virtual) handle in given array of ASCII strings. These constants are all in the byte range and apply to the interpretation of , Use the highest bit to mark tokens that are virtual (synthesized). We create virtual tokens to represent projected WinMD entities. In the case of string handles, the two lower bits that (in addition to the virtual bit not included in this mask) encode how to obtain the string value. Use the highest bit to mark tokens that are virtual (synthesized). We create virtual tokens to represent projected WinMD entities. Returns true if the token value can escape the metadata reader. We don't allow virtual tokens and heap tokens other than UserString to escape since the token type ids are internal to the reader and not specified by ECMA spec. Spec (Partition III, 1.9 Metadata tokens): Many CIL instructions are followed by a "metadata token". This is a 4-byte value, that specifies a row in a metadata table, or a starting byte offset in the User String heap. For example, a value of 0x02 specifies the TypeDef table; a value of 0x70 specifies the User String heap.The value corresponds to the number assigned to that metadata table (see Partition II for the full list of tables) or to 0x70 for the User String heap.The least-significant 3 bytes specify the target row within that metadata table, or starting byte offset within the User String heap. Returns whether the namespaceTable has been created. If it hasn't, calling a GetXXX method on this will probably have a very high amount of overhead. This will return a StringHandle for the simple name of a namespace name at the given segment index. If no segment index is passed explicitly or the "segment" index is greater than or equal to the number of segments, then the last segment is used. "Segment" in this context refers to part of a namespace name between dots. Example: Given a NamespaceDefinitionHandle to "System.Collections.Generic.Test" called 'handle': reader.GetString(GetSimpleName(handle)) == "Test" reader.GetString(GetSimpleName(handle, 0)) == "System" reader.GetString(GetSimpleName(handle, 1)) == "Collections" reader.GetString(GetSimpleName(handle, 2)) == "Generic" reader.GetString(GetSimpleName(handle, 3)) == "Test" reader.GetString(GetSimpleName(handle, 1000)) == "Test" Two distinct namespace handles represent the same namespace if their full names are the same. This method merges builders corresponding to such namespace handles. This will take 'table' and merge all of the NamespaceData instances that point to the same namespace. It has to create 'stringTable' as an intermediate dictionary, so it will hand it back to the caller should the caller want to use it. Creates a NamespaceDataBuilder instance that contains a synthesized NamespaceDefinitionHandle, as well as the name provided. Quick convenience method that handles linking together child + parent Links a child to its parent namespace. If the parent namespace doesn't exist, this will create a virtual one. This will automatically link any virtual namespaces it creates up to its parents. This will link all parents/children in the given namespaces dictionary up to each other. In some cases, we need to synthesize namespaces that do not have any type definitions or forwarders of their own, but do have child namespaces. These are returned via the virtualNamespaces out parameter. Loops through all type definitions in metadata, adding them to the given table Loops through all type forwarders in metadata, adding them to the given table Populates namespaceList with distinct namespaces. No ordering is guaranteed. If the namespace table doesn't exist, populates it! If the namespace list doesn't exist, populates it! An intermediate class used to build NamespaceData instances. This was created because we wanted to use ImmutableArrays in NamespaceData, but having ArrayBuilders and ImmutableArrays that served the same purpose in NamespaceData got ugly. With the current design of how we create our Namespace dictionary, this needs to be a class because we have a many-to-one mapping between NamespaceHandles and NamespaceData. So, the pointer semantics must be preserved. This class assumes that the builders will not be modified in any way after the first call to Freeze(). Returns a NamespaceData that represents this NamespaceDataBuilder instance. After calling this method, it is an error to use any methods or fields except Freeze() on the target NamespaceDataBuilder. Returns field offset for given field RowId, or -1 if not available. In CLI metadata equal to the actual number of entries in AssemblyRef table. In WinMD metadata it includes synthesized AssemblyRefs in addition. Represents a metadata entity (type reference/definition/specification, method definition, custom attribute, etc.). Use to store multiple kinds of entity handles. It has smaller memory footprint than . Value stored in a specific entity handle (see , , etc.). Compares the current content of this writer with another one. Range specified by and falls outside of the bounds of the buffer content. Range specified by and falls outside of the bounds of the buffer content. is negative. is null. is negative. is null. is null. is negative. is null. is null. Range specified by and falls outside of the bounds of the . is null. is null. Range specified by and falls outside of the bounds of the . Writes a reference to a heap (heap offset) or a table (row number). Heap offset or table row number. True to encode the reference as 16-bit integer, false to encode as 32-bit integer. Writes UTF16 (little-endian) encoded string at the current position. is null. Writes UTF16 (little-endian) encoded string at the current position. is null. Writes string in SerString format (see ECMA-335-II 23.3 Custom attributes). The string is UTF8 encoded and prefixed by the its size in bytes. Null string is represented as a single byte 0xFF. Builder is not writable, it has been linked with another one. Writes string in User String (#US) heap format (see ECMA-335-II 24.2.4 #US and #Blob heaps): The string is UTF16 encoded and prefixed by the its size in bytes. This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following: 0x01–0x08, 0x0E–0x1F, 0x27, 0x2D, 0x7F. Otherwise, it holds 0. The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets. Builder is not writable, it has been linked with another one. Writes UTF8 encoded string at the current position. is null. Implements compressed signed integer encoding as defined by ECMA-335-II chapter 23.2: Blobs and signatures. If the value lies between -64 (0xFFFFFFC0) and 63 (0x3F), inclusive, encode as a one-byte integer: bit 7 clear, value bits 5 through 0 held in bits 6 through 1, sign bit (value bit 31) in bit 0. If the value lies between -8192 (0xFFFFE000) and 8191 (0x1FFF), inclusive, encode as a two-byte integer: 15 set, bit 14 clear, value bits 12 through 0 held in bits 13 through 1, sign bit(value bit 31) in bit 0. If the value lies between -268435456 (0xF000000) and 268435455 (0x0FFFFFFF), inclusive, encode as a four-byte integer: 31 set, 30 set, bit 29 clear, value bits 27 through 0 held in bits 28 through 1, sign bit(value bit 31) in bit 0. can't be represented as a compressed signed integer. Implements compressed unsigned integer encoding as defined by ECMA-335-II chapter 23.2: Blobs and signatures. If the value lies between 0 (0x00) and 127 (0x7F), inclusive, encode as a one-byte integer (bit 7 is clear, value held in bits 6 through 0). If the value lies between 28 (0x80) and 214 – 1 (0x3FFF), inclusive, encode as a 2-byte integer with bit 15 set, bit 14 clear(value held in bits 13 through 0). Otherwise, encode as a 4-byte integer, with bit 31 set, bit 30 set, bit 29 clear (value held in bits 28 through 0). can't be represented as a compressed signed integer. Writes a constant value (see ECMA-335 Partition II section 22.9) at the current position. is not of a constant type. Returns a sequence of all blobs that represent the content of the builder. Content is not available, the builder has been linked with another one. Compares the current content of this writer with another one. Content is not available, the builder has been linked with another one. Content is not available, the builder has been linked with another one. Range specified by and falls outside of the bounds of the buffer content. Content is not available, the builder has been linked with another one. Content is not available, the builder has been linked with another one. Range specified by and falls outside of the bounds of the buffer content. Content is not available, the builder has been linked with another one. is null. Content is not available, the builder has been linked with another one. is default(). Content is not available, the builder has been linked with another one. is null. Content is not available, the builder has been linked with another one. is null. Builder is not writable, it has been linked with another one. is null. Builder is not writable, it has been linked with another one. Reserves a contiguous block of bytes. is negative. Builder is not writable, it has been linked with another one. is negative. Builder is not writable, it has been linked with another one. is null. is negative. Builder is not writable, it has been linked with another one. is null. is negative. Builder is not writable, it has been linked with another one. Bytes successfully written from the . is null. Builder is not writable, it has been linked with another one. is null. Range specified by and falls outside of the bounds of the . Builder is not writable, it has been linked with another one. is null. Builder is not writable, it has been linked with another one. is null. Range specified by and falls outside of the bounds of the . Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Builder is not writable, it has been linked with another one. Writes a reference to a heap (heap offset) or a table (row number). Heap offset or table row number. True to encode the reference as 16-bit integer, false to encode as 32-bit integer. Builder is not writable, it has been linked with another one. Writes UTF16 (little-endian) encoded string at the current position. is null. Builder is not writable, it has been linked with another one. Writes UTF16 (little-endian) encoded string at the current position. is null. Builder is not writable, it has been linked with another one. Writes string in SerString format (see ECMA-335-II 23.3 Custom attributes). The string is UTF8 encoded and prefixed by the its size in bytes. Null string is represented as a single byte 0xFF. Builder is not writable, it has been linked with another one. Writes string in User String (#US) heap format (see ECMA-335-II 24.2.4 #US and #Blob heaps): The string is UTF16 encoded and prefixed by the its size in bytes. This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following: 0x01–0x08, 0x0E–0x1F, 0x27, 0x2D, 0x7F. Otherwise, it holds 0. The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets. Builder is not writable, it has been linked with another one. Writes UTF8 encoded string at the current position. Constant value. True to encode unpaired surrogates as specified, otherwise replace them with U+FFFD character. is null. Builder is not writable, it has been linked with another one. Implements compressed signed integer encoding as defined by ECMA-335-II chapter 23.2: Blobs and signatures. If the value lies between -64 (0xFFFFFFC0) and 63 (0x3F), inclusive, encode as a one-byte integer: bit 7 clear, value bits 5 through 0 held in bits 6 through 1, sign bit (value bit 31) in bit 0. If the value lies between -8192 (0xFFFFE000) and 8191 (0x1FFF), inclusive, encode as a two-byte integer: 15 set, bit 14 clear, value bits 12 through 0 held in bits 13 through 1, sign bit(value bit 31) in bit 0. If the value lies between -268435456 (0xF000000) and 268435455 (0x0FFFFFFF), inclusive, encode as a four-byte integer: 31 set, 30 set, bit 29 clear, value bits 27 through 0 held in bits 28 through 1, sign bit(value bit 31) in bit 0. can't be represented as a compressed signed integer. Builder is not writable, it has been linked with another one. Implements compressed unsigned integer encoding as defined by ECMA-335-II chapter 23.2: Blobs and signatures. If the value lies between 0 (0x00) and 127 (0x7F), inclusive, encode as a one-byte integer (bit 7 is clear, value held in bits 6 through 0). If the value lies between 28 (0x80) and 214 – 1 (0x3FFF), inclusive, encode as a 2-byte integer with bit 15 set, bit 14 clear (value held in bits 13 through 0). Otherwise, encode as a 4-byte integer, with bit 31 set, bit 30 set, bit 29 clear (value held in bits 28 through 0). can't be represented as a compressed integer. Builder is not writable, it has been linked with another one. Writes a constant value (see ECMA-335 Partition II section 22.9) at the current position. is not of a constant type. Builder is not writable, it has been linked with another one. Gets the TType representation for . Returns true if the given type represents . Get the type symbol for the given serialized type name. The serialized type name is in so-called "reflection notation" (i.e. as understood by .) The name is malformed. Gets the underlying type of the given enum type symbol. The given type symbol does not represent an enum. Returns true of the specified op-code is a branch to a label. Calculate the size of the specified branch instruction operand. Branch op-code. 1 if is a short branch or 4 if it is a long branch. Specified is not a branch op-code. Get a short form of the specified branch op-code. Branch op-code. Short form of the branch op-code. Specified is not a branch op-code. Get a long form of the specified branch op-code. Branch op-code. Long form of the branch op-code. Specified is not a branch op-code. By default the stream is disposed when is disposed and sections of the PE image are read lazily. Keep the stream open when the is disposed. Reads PDB metadata into memory right away. The underlying file may be closed and even deleted after is constructed. closes the stream automatically by the time the constructor returns unless is specified. Provides a metadata stored in an array of bytes, a memory block, or a stream. Supported formats: - ECMA-335 CLI (Common Language Infrastructure) metadata () - Edit and Continue metadata delta () - Portable PDB metadata () Creates a Portable PDB metadata provider over a blob stored in memory. Pointer to the start of the Portable PDB blob. The size of the Portable PDB blob. is . is negative. The memory is owned by the caller and not released on disposal of the . The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the . The content of the blob is not read during the construction of the Creates a metadata provider over an image stored in memory. Pointer to the start of the metadata blob. The size of the metadata blob. is . is negative. The memory is owned by the caller and not released on disposal of the . The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the . The content of the blob is not read during the construction of the Creates a Portable PDB metadata provider over a byte array. Portable PDB image. The content of the image is not read during the construction of the is null. Creates a provider over a byte array. Metadata image. The content of the image is not read during the construction of the is null. Creates a provider for a stream of the specified size beginning at its current position. Stream. Size of the metadata blob in the stream. If not specified the metadata blob is assumed to span to the end of the stream. Options specifying how sections of the image are read from the stream. Unless is specified, ownership of the stream is transferred to the upon successful argument validation. It will be disposed by the and the caller must not manipulate it. Unless is specified no data is read from the stream during the construction of the . Furthermore, the stream must not be manipulated by caller while the is alive and undisposed. If , the will have read all of the data requested during construction. As such, if is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the after construction. Size is negative or extends past the end of the stream. Creates a provider for a stream of the specified size beginning at its current position. Stream. Size of the metadata blob in the stream. If not specified the metadata blob is assumed to span to the end of the stream. Options specifying how sections of the image are read from the stream. Unless is specified, ownership of the stream is transferred to the upon successful argument validation. It will be disposed by the and the caller must not manipulate it. Unless is specified no data is read from the stream during the construction of the . Furthermore, the stream must not be manipulated by caller while the is alive and undisposed. If , the will have read all of the data requested during construction. As such, if is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the after construction. Size is negative or extends past the end of the stream. Disposes all memory allocated by the reader. can be called multiple times (but not in parallel). It is not safe to call in parallel with any other operation on the or reading from the underlying memory. Gets a from a . The caller must keep the alive and undisposed throughout the lifetime of the metadata reader. The encoding of is not . The current platform is big-endian. Type codes used to encode types of primitive values in Custom Attribute value blob. Returns a handle to corresponding to this handle. The resulting handle is only valid within the context of a open on the Portable PDB blob, which in case of standalone PDB file is a different reader than the one containing this method definition. #UserString heap handle. The handle is 32-bit wide. A handle that represents a namespace definition. True if the file contains metadata. Corresponds to Flags field of File table in ECMA-335 Standard. File name with extension. Corresponds to Name field of File table in ECMA-335 Standard. Hash value of the file content calculated using . Corresponds to HashValue field of File table in ECMA-335 Standard. An array containing the '\0' character. Reads number. Decimal number is encoded in 13 bytes as follows: - byte 0: highest bit indicates sign (1 for negative, 0 for non-negative); the remaining 7 bits encode scale - bytes 1..12: 96-bit unsigned integer in little endian encoding. The data at the current position was not a valid number. Reads UTF8 encoded string starting at the current position. The number of bytes to read. The string. bytes not available. Reads UTF16 (little-endian) encoded string starting at the current position. The number of bytes to read. The string. bytes not available. Reads bytes starting at the current position. The number of bytes to read. The byte array. bytes not available. Reads an unsigned compressed integer value. See Metadata Specification section II.23.2: Blobs and signatures. The value of the compressed integer that was read. true if the value was read successfully. false if the data at the current position was not a valid compressed integer. Reads an unsigned compressed integer value. See Metadata Specification section II.23.2: Blobs and signatures. The value of the compressed integer that was read. The data at the current position was not a valid compressed integer. Reads a signed compressed integer value. See Metadata Specification section II.23.2: Blobs and signatures. The value of the compressed integer that was read. true if the value was read successfully. false if the data at the current position was not a valid compressed integer. Reads a signed compressed integer value. See Metadata Specification section II.23.2: Blobs and signatures. The value of the compressed integer that was read. The data at the current position was not a valid compressed integer. Reads type code encoded in a serialized custom attribute value. if the encoding is invalid. Reads type code encoded in a signature. if the encoding is invalid. Reads a string encoded as a compressed integer containing its length followed by its contents in UTF8. Null strings are encoded as a single 0xFF byte. Defined as a 'SerString' in the ECMA CLI specification. String value or null. If the encoding is invalid. Reads a type handle encoded in a signature as TypeDefOrRefOrSpecEncoded (see ECMA-335 II.23.2.8). The handle or nil if the encoding is invalid. Reads a #Blob heap handle encoded as a compressed integer. Blobs that contain references to other blobs are used in Portable PDB format, for example . Reads a constant value (see ECMA-335 Partition II section 22.9) from the current position. Error while reading from the blob. is not a valid . Boxed constant value. To avoid allocating the object use Read* methods directly. Constants of type are encoded as UTF16 strings, use to read them. The type of the constant value. Corresponds to Type field of Constant table in ECMA-335 Standard. The constant value. Corresponds to Value field of Constant table in ECMA-335 Standard. The parent handle (, , or ). Corresponds to Parent field of Constant table in ECMA-335 Standard. The constructor ( or ) of the custom attribute type. Corresponds to Type field of CustomAttribute table in ECMA-335 Standard. The handle of the metadata entity the attribute is applied to. Corresponds to Parent field of CustomAttribute table in ECMA-335 Standard. The value of the attribute. Corresponds to Value field of CustomAttribute table in ECMA-335 Standard. Decodes the arguments encoded in the value blob. Represents the shape of an array type. Gets the number of dimensions in the array. Gets the sizes of each dimension. Length may be smaller than rank, in which case the trailing dimensions have unspecified sizes. Gets the lower-bounds of each dimension. Length may be smaller than rank, in which case the trailing dimensions have unspecified lower bounds. Gets the type symbol for a single-dimensional array with zero lower bounds of the given element type. Gets the a type symbol for the function pointer type of the given method signature. Gets the type symbol for the generic method parameter at the given zero-based index. Gets the type symbol for the generic type parameter at the given zero-based index. Gets the type symbol for a type with a custom modifier applied. The metadata reader that was passed to the . It may be null. True if the modifier is required, false if it's optional. The modifier type applied. The type symbol of the underlying type without modifiers applied. Gets the type symbol for a local variable type that is marked as pinned. Gets the type symbol for a type definition. The metadata reader that was passed to the signature decoder. It may be null. The type definition handle. The kind of the type as specified in the signature. To interpret this value use Note that when the signature comes from a WinMD file additional processing is needed to determine whether the target type is a value type or a reference type. Gets the type symbol for a type reference. The metadata reader that was passed to the signature decoder. It may be null. The type definition handle. The kind of the type as specified in the signature. To interpret this value use Note that when the signature comes from a WinMD file additional processing is needed to determine whether the target type is a value type or a reference type. Gets the type symbol for a type specification. The metadata reader that was passed to the signature decoder. It may be null. The type specification handle. The kind of the type as specified in the signature. To interpret this value use Note that when the signature comes from a WinMD file additional processing is needed to determine whether the target type is a value type or a reference type. It is not known in the current context if the type reference or definition is a class or value type. The type definition or reference refers to a class. The type definition or reference refers to a value type. Gets the type symbol for a primitive type. Gets the type symbol for a generic instantiation of the given generic type with the given type arguments. Gets the type symbol for a generalized array of the given element type and shape. Gets the type symbol for a managed pointer to the given element type. Gets the type symbol for an unmanaged pointer to the given element ty Represents a method (definition, reference, or standalone) or property signature. In the case of properties, the signature matches that of a getter with a distinguishing . Represents the information in the leading byte of the signature (kind, calling convention, flags). Gets the method's return type. Gets the number of parameters that are required. Will be equal to the length of unless this signature represents the standalone call site of a vararg method, in which case the entries extra entries in are the types used for the optional parameters. Gets the number of generic type parameters of the method. Will be 0 for non-generic methods. Gets the method's parameter types. Represents a primitive type found in metadata signatures. Start IL offset of the try block. Length in bytes of try block. Start IL offset of the exception handler. Length in bytes of the exception handler. IL offset of the start of the filter block, or -1 if the region is not a filter. Returns a TypeRef, TypeDef, or TypeSpec handle if the region represents a catch, nil token otherwise. Name of the target type, or nil if the type is nested or defined in a root namespace. Full name of the namespace where the target type, or nil if the type is nested or defined in a root namespace. The definition handle of the namespace where the target type is defined, or nil if the type is nested or defined in a root namespace. Handle to resolve the implementation of the target type. representing another module in the assembly. representing another assembly if is true. representing the declaring exported type in which this was is nested. Returns field layout offset, or -1 if not available. or . Corresponds to Owner field of GenericParam table in ECMA-335 Standard. Attributes specifying variance and constraints. Corresponds to Flags field of GenericParam table in ECMA-335 Standard. Zero-based index of the parameter within the declaring generic type or method declaration. Corresponds to Number field of GenericParam table in ECMA-335 Standard. The name of the generic parameter. Corresponds to Name field of GenericParam table in ECMA-335 Standard. The constrained . Corresponds to Owner field of GenericParamConstraint table in ECMA-335 Standard. Handle (, , or ) specifying from which type this generic parameter is constrained to derive, or which interface this generic parameter is constrained to implement. Corresponds to Constraint field of GenericParamConstraint table in ECMA-335 Standard. Represents generic type parameters of a method or type. Represents constraints of a generic type parameter. Collection of parameters of a specified method. Represents a collection of . Represents a collection of . Represents a collection of . Represents a collection of . Collection of assembly references. Represents a collection of . Represents a collection of . Compares two handles. The order of handles that differ in kind and are not is undefined. Returns 0 if and only if returns true. Compares two entity handles. Returns 0 if and only if returns true. Represents any metadata entity (type reference/definition/specification, method definition, custom attribute, etc.) or value (string, blob, guid, user string). Use to store multiple kinds of handles. Creates from a token or a token combined with a virtual flag. Token type (0x##000000), does not include virtual flag. Small token type (0x##), does not include virtual flag. Value stored in an . Value stored in a concrete entity handle (see , , etc.). The interface that is implemented , , or Specifies the byte offset within the referenced file at which this resource record begins. Corresponds to Offset field of ManifestResource table in ECMA-335 Standard. Resource attributes. Corresponds to Flags field of ManifestResource table in ECMA-335 Standard. Name of the resource. Corresponds to Name field of ManifestResource table in ECMA-335 Standard. , , or nil handle. Corresponds to Implementation field of ManifestResource table in ECMA-335 Standard. If nil then is an offset in the PE image that contains the metadata, starting from the Resource entry in the CLI header. MethodDef, ModuleRef,TypeDef, TypeRef, or TypeSpec handle. Gets a handle to the signature blob. Determines if the member reference is to a method or field. The member reference signature is invalid. Indicates whether a represents a standalone method or local variable signature. The represents a standalone method signature. The references a local variable signature. Indicates whether a references a method or field. The references a method. The references a field. CLI metadata. Windows Metadata. Windows Metadata generated by managed compilers. Reads metadata as defined byte the ECMA 335 CLI specification. Creates a metadata reader from the metadata stored at the given memory location. The memory is owned by the caller and it must be kept memory alive and unmodified throughout the lifetime of the . Creates a metadata reader from the metadata stored at the given memory location. The memory is owned by the caller and it must be kept memory alive and unmodified throughout the lifetime of the . Use to obtain metadata from a PE image. Creates a metadata reader from the metadata stored at the given memory location. The memory is owned by the caller and it must be kept memory alive and unmodified throughout the lifetime of the . Use to obtain metadata from a PE image. is not positive. is null. The encoding of is not . The current platform is big-endian. True if the metadata stream has minimal delta format. Used for EnC. The metadata stream has minimal delta format if "#JTD" stream is present. Minimal delta format uses large size (4B) when encoding table/heap references. The heaps in minimal delta only contain data of the delta, there is no padding at the beginning of the heaps that would align them with the original full metadata heaps. Looks like this function reads beginning of the header described in ECMA-335 24.2.1 Metadata root Reads stream headers described in ECMA-335 24.2.2 Stream header A row count for each possible table. May be indexed by . Information decoded from #Pdb stream, or null if the stream is not present. Returns an array of types nested in the specified type. The backing field of a WinRT enumeration type is not public although the backing fields of managed enumerations are. To allow managed languages to directly access this field, it is made public by the metadata adapter. We want to know if a given method implements a redirected interface. For example, if we are given the method RemoveAt on a class "A" which implements the IVector interface (which is redirected to IList in .NET) then this method would return true. The most likely reason why we would want to know this is that we wish to hide (mark private) all methods which implement methods on a redirected interface. The declaration token for the method Returns true if the redirected interface is . True if the method implements a method on a redirected interface. False otherwise. Returns the type definition or reference handle of the attribute type. or or nil token if the metadata is invalid and the type can't be determined. All options are disabled. The options that are used when a is obtained via an overload that does not take a argument. Windows Runtime projections are enabled (on by default). Provides string comparison helpers to query strings in metadata while avoiding allocation where possible. No allocation is performed unless both the handle argument and the value argument contain non-ascii text. Obtain instances using . A default-initialized instance is useless and behaves as a null reference. The code is optimized such that there is no additional overhead in re-obtaining a a comparer over hoisting it in to a local. That is to say that a construct like: if (reader.StringComparer.Equals(typeDef.Namespace, "System") && reader.StringComparer.Equals(typeDef.Name, "Object") { // found System.Object } is no less efficient than: var comparer = reader.StringComparer; if (comparer.Equals(typeDef.Namespace, "System") && comparer.Equals(typeDef.Name, "Object") { // found System.Object } The choice between them is therefore one of style and not performance. Provides the with a custom mechanism for decoding byte sequences in metadata that represent text. This can be used for the following purposes: 1) To customize the treatment of invalid input. When no decoder is provided, the uses the default fallback replacement with \uFFFD) 2) To reuse existing strings instead of allocating a new one for each decoding operation. The default decoder used by to decode UTF-8 when no decoder is provided to the constructor. Creates a for the given encoding. The encoding to use. To cache and reuse existing strings. Create a derived class and override Gets the encoding used by this instance. The mechanism through which the obtains strings for byte sequences in metadata. Override this to cache strings if required. Otherwise, it is implemented by forwarding straight to and every call will allocate a new string. Pointer to bytes to decode. Number of bytes to decode. The decoded string. Size of the method body - includes the header, IL and exception regions. MethodDef or MemberRef handle specifying to which generic method this refers, that is which generic method is it an instantiation of. Gets a handle to the signature blob. Gets the unqualified name of the NamespaceDefinition. Gets the parent namespace. Gets the namespace definitions that are direct children of the current namespace definition. System.Collections and System.Linq are direct children of System. System.Collections.Generic is a direct child of System.Collections. System.Collections.Generic is *not* a direct child of System. Gets all type definitions that reside directly in a namespace. Gets all exported types that reside directly in a namespace. Source document in debug metadata. See also https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#document-table-0x30. Returns Document Name Blob. Source code language (C#, VB, F#, etc.) Hash algorithm used to calculate (SHA1, SHA256, etc.) Document content hash. determines the algorithm used to produce this hash. The source document is hashed in its binary form as stored in the file. representing a blob on #Blob heap in Portable PDB structured as Document Name. The kind of the handle is . The handle is a specialization of and doesn't have a distinct kind. Returns a handle to corresponding to this handle. The resulting handle is only valid within the context of a open on the type system metadata blob, which in case of standalone PDB file is a different reader than the one containing this method debug information. Invalid blob format. Local constant. Stored in debug metadata. See https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#localconstant-table-0x34. The constant signature. Lexical scope within which a group of imports are available. Stored in debug metadata. See https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#importscope-table-0x35 Scope of local variables and constants. Stored in debug metadata. See https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#localscope-table-0x32. Local variable. Stored in debug metadata. See https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#localvariable-table-0x33. Debug information associated with a method definition. Stored in debug metadata. See https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#methoddebuginformation-table-0x31. Returns a blob encoding sequence points. Use to decode. The document containing the first sequence point of the method, or nil if the method doesn't have sequence points. Returns local signature handle. If the method is a MoveNext method of a state machine returns the kickoff method of the state machine, otherwise returns nil handle. Returns a body block of a method with specified Relative Virtual Address (RVA); is null. The body is not found in the metadata or is invalid. Section where the method is stored is not available. Gets a from a . The caller must keep the alive and undisposed throughout the lifetime of the metadata reader. is null The current platform is big-endian. Gets a from a . The caller must keep the alive and undisposed throughout the lifetime of the metadata reader. is null The current platform is big-endian. Gets a from a . The caller must keep the alive and undisposed throughout the lifetime of the metadata reader. is null The encoding of is not . The current platform is big-endian. Type codes used to encode types of values in Custom Attribute value blob. Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . Equivalent to . The attribute argument is a System.Type instance. The attribute argument is "boxed" (passed to a parameter, field, or property of type object) and carries type information in the attribute blob. The attribute argument is an Enum instance. Specified additional flags that can be applied to method signatures. Underlying values correspond to the representation in the leading signature byte represented by . No flags. Generic method. Instance method. Ecma 335 CLI Specification refers to this flag as HAS_THIS. The first explicitly declared parameter represents the instance pointer. Specifies how arguments in a given signature are passed from the caller to the callee. Underlying values correspond to the representation in the leading signature byte represented by . Managed calling convention with fixed-length argument list. Unmanaged C/C++-style calling convention where the call stack is cleaned by the caller. Unmanaged calling convention where call stack is cleaned up by the callee. Unmanaged C++-style calling convention for calling instance member functions with a fixed argument list. Unmanaged calling convention where arguments are passed in registers when possible. Managed calling convention for passing extra arguments. Represents the signature characteristics specified by the leading byte of signature blobs. This header byte is present in all method definition, method reference, standalone method, field, property, and local variable signatures, but not in type specification signatures. Specifies the signature kind. Underlying values correspond to the representation in the leading signature byte represented by . Method reference, method definition, or standalone method signature. Field signature. Local variables signature. Property signature. Method specification signature. Represents the type codes that are used in signature encoding. Represents an invalid or uninitialized type code. It will not appear in valid signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents in signatures. Represents a unmanaged pointers in signatures. It is followed in the blob by the signature encoding of the underlying type. Represents managed pointers (byref return values and parameters) in signatures. It is followed in the blob by the signature encoding of the underlying type. Represents a generic type parameter used within a signature. Represents a generalized in signatures. Represents the instantiation of a generic type in signatures. Represents a System.TypedReference in signatures. Represents a in signatures. Represents a in signatures. Represents function pointer types in signatures. Represents Represents a single dimensional with 0 lower bound. Represents a generic method parameter used within a signature. Represents a custom modifier applied to a type within a signature that the caller must understand. Represents a custom modifier applied to a type within a signature that the caller can ignore. Precedes a type in signatures. In raw metadata, this will be encoded as either ELEMENT_TYPE_CLASS (0x12) for reference types and ELEMENT_TYPE_VALUETYPE (0x11) for value types. This is collapsed to a single code because Windows Runtime projections can project from class to value type or vice-versa and the raw code is misleading in those cases. Represents a marker to indicate the end of fixed arguments and the beginning of variable arguments. Represents a local variable that is pinned by garbage collector Gets a handle to the signature blob. Determines the kind of signature, which can be or The signature is invalid. Name of the type. Full name of the namespace where the type is defined, or nil if the type is nested or defined in a root namespace. The definition handle of the namespace where the type is defined, or nil if the type is nested or defined in a root namespace. The base type of the type definition: either , or . Returns the enclosing type of a specified nested type or nil handle if the type is not nested. Returns an array of types nested in the specified type. Resolution scope in which the target type is defined and is uniquely identified by the specified and . Resolution scope can be one of the following handles: of the enclosing type, if the target type is a nested type. , if the target type is defined in another module within the same assembly as this one. , if the target type is defined in the current module. This should not occur in a CLI compressed metadata module. , if the target type is defined in a different assembly from the current module. Nil handle if the target type must be resolved by searching the for a matching and . Name of the target type. Full name of the namespace where the target type is defined, or nil if the type is nested or defined in a root namespace. Managed .text PE section. Contains in the following order: - Import Address Table - COR Header - IL - Metadata - Managed Resource Data - Strong Name Signature - Debug Data (directory and extra info) - Import Table - Name Table - Runtime Startup Stub - Mapped Field Data The size of IL stream (unaligned). Total size of metadata (header and all streams). The size of managed resource data stream. Aligned to . Size of strong name hash. Size of Debug data. The size of mapped field data stream. Aligned to . If set, the module must include a machine code stub that transfers control to the virtual execution system. If set, the module contains instructions that assume a 64 bit instruction set. For example it may depend on an address being 64 bits. This may be true even if the module contains only IL instructions because of PlatformInvoke and COM interop. Serializes .text section data into a specified . An empty builder to serialize section data to. Relative virtual address of the section within the containing PE file. Entry point token or RVA () COR Flags (). Base address of the PE image. containing metadata. Must be populated with data. Linked into the and can't be expanded afterwards. containing IL stream. Must be populated with data. Linked into the and can't be expanded afterwards. containing mapped field data. Must be populated with data. Linked into the and can't be expanded afterwards. containing managed resource data. Must be populated with data. Linked into the and can't be expanded afterwards. containing PE debug table and data. Must be populated with data. Linked into the and can't be expanded afterwards. Blob reserved in the for strong name signature. Serialize the Debug Table and Data. Builder. The containing PE section location. Offset of the table within the containing section. Aka IMAGE_DIRECTORY_ENTRY_EXPORT. Aka IMAGE_DIRECTORY_ENTRY_IMPORT. Aka IMAGE_DIRECTORY_ENTRY_RESOURCE. Aka IMAGE_DIRECTORY_ENTRY_EXCEPTION. Aka IMAGE_DIRECTORY_ENTRY_BASERELOC. Aka IMAGE_DIRECTORY_ENTRY_DEBUG. Aka IMAGE_DIRECTORY_ENTRY_COPYRIGHT or IMAGE_DIRECTORY_ENTRY_ARCHITECTURE. Aka IMAGE_DIRECTORY_ENTRY_GLOBALPTR. Aka IMAGE_DIRECTORY_ENTRY_TLS. Aka IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG. Aka IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT. Aka IMAGE_DIRECTORY_ENTRY_IAT. Aka IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT. Aka IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR. Base class for PE resource section builder. Implement to provide serialization logic for native resources. The type of target machine. The number of sections. This indicates the size of the section table, which immediately follows the headers. The low 32 bits of the number of seconds since 00:00 January 1, 1970, that indicates when the file was created. The file pointer to the COFF symbol table, or zero if no COFF symbol table is present. This value should be zero for a PE image. The number of entries in the symbol table. This data can be used to locate the string table, which immediately follows the symbol table. This value should be zero for a PE image. The size of the optional header, which is required for executable files but not for object files. This value should be zero for an object file. The flags that indicate the attributes of the file. COR20Flags GUID (Globally Unique Identifier) of the associated PDB. Iteration of the PDB. The first iteration is 1. The iteration is incremented each time the PDB content is augmented. Path to the .pdb file containing debug information for the PE/COFF file. Identifies the location, size and format of a block of debug information. The time and date that the debug data was created if the PE/COFF file is not deterministic, otherwise a value based on the hash of the content. The algorithm used to calculate this value is an implementation detail of the tool that produced the file. The major version number of the debug data format. The minor version number of the debug data format. The format of debugging information. The size of the debug data (not including the debug directory itself). The address of the debug data when loaded, relative to the image base. The file pointer to the debug data. An unknown value that is ignored by all tools. The COFF debug information (line numbers, symbol table, and string table). This type of debug information is also pointed to by fields in the file headers. Associated PDB file description. Presence of this entry indicates deterministic PE/COFF file. The tool that produced the deterministic PE/COFF file guarantees that the entire content of the file is based solely on documented inputs given to the tool (such as source files, resource files, compiler options, etc.) rather than ambient environment variables (such as the current time, the operating system, the bitness of the process running the tool, etc.). The value of field TimeDateStamp in COFF File Header of a deterministic PE/COFF file does not indicate the date and time when the file was produced and should not be interpreted that way. Instead the value of the field is derived from a hash of the file content. The algorithm to calculate this value is an implementation detail of the tool that produced the file. The debug directory entry of type must have all fields, except for Type zeroed. The target CPU is unknown or not specified. Intel 386. MIPS little-endian WCE v2 Alpha Hitachi SH3 little endian Hitachi SH3 DSP. Hitachi SH3 little endian. Hitachi SH4 little endian. Hitachi SH5. ARM little endian Thumb. ARM Thumb-2 little endian. Matsushita AM33. IBM PowerPC little endian. PowerPCFP Intel 64 MIPS ALPHA64 MIPS with FPU. MIPS16 with FPU. Infineon EFI Byte Code AMD64 (K8) M32R little-endian Simple BinaryReader wrapper to: 1) throw BadImageFormat instead of EndOfStream or ArgumentOutOfRange. 2) limit reads to a subset of the base stream. Only methods that are needed to read PE headers are implemented. Reads a fixed-length byte block as a null-padded UTF8-encoded string. The padding is not included in the returned string. Note that it is legal for UTF8 strings to contain NUL; if NUL occurs between non-NUL codepoints, it is not considered to be padding and is included in the result. Reserved. Reserved. Reserved. Reserved. Image can handle a high entropy 64-bit virtual address space. DLL can move. Image is NX compatible. Image understands isolation and doesn't want it. Image does not use SEH. No SE handler may reside in this image. Do not bind this image. The image must run inside an AppContainer. Driver uses WDM model. Identifies the format of the image file. The linker major version number. The linker minor version number. The size of the code (text) section, or the sum of all code sections if there are multiple sections. The size of the initialized data section, or the sum of all such sections if there are multiple data sections. The size of the uninitialized data section (BSS), or the sum of all such sections if there are multiple BSS sections. The address of the entry point relative to the image base when the PE file is loaded into memory. For program images, this is the starting address. For device drivers, this is the address of the initialization function. An entry point is optional for DLLs. When no entry point is present, this field must be zero. The address that is relative to the image base of the beginning-of-code section when it is loaded into memory. The address that is relative to the image base of the beginning-of-data section when it is loaded into memory. The preferred address of the first byte of image when loaded into memory; must be a multiple of 64K. The alignment (in bytes) of sections when they are loaded into memory. It must be greater than or equal to . The default is the page size for the architecture. The alignment factor (in bytes) that is used to align the raw data of sections in the image file. The value should be a power of 2 between 512 and 64K, inclusive. The default is 512. If the is less than the architecture's page size, then must match . The major version number of the required operating system. The minor version number of the required operating system. The major version number of the image. The minor version number of the image. The major version number of the subsystem. The minor version number of the subsystem. The size (in bytes) of the image, including all headers, as the image is loaded in memory. It must be a multiple of . The combined size of an MS DOS stub, PE header, and section headers rounded up to a multiple of FileAlignment. The image file checksum. The subsystem that is required to run this image. The size of the stack to reserve. Only is committed; the rest is made available one page at a time until the reserve size is reached. The size of the stack to commit. The size of the local heap space to reserve. Only is committed; the rest is made available one page at a time until the reserve size is reached. The size of the local heap space to commit. The number of data-directory entries in the remainder of the . Each describes a location and size. Aka IMAGE_DIRECTORY_ENTRY_EXPORT. Aka IMAGE_DIRECTORY_ENTRY_IMPORT. Aka IMAGE_DIRECTORY_ENTRY_RESOURCE. Aka IMAGE_DIRECTORY_ENTRY_EXCEPTION. The Certificate Table entry points to a table of attribute certificates. These certificates are not loaded into memory as part of the image. As such, the first field of this entry, which is normally an RVA, is a file pointer instead. Aka IMAGE_DIRECTORY_ENTRY_SECURITY. Aka IMAGE_DIRECTORY_ENTRY_BASERELOC. Aka IMAGE_DIRECTORY_ENTRY_DEBUG. Aka IMAGE_DIRECTORY_ENTRY_COPYRIGHT or IMAGE_DIRECTORY_ENTRY_ARCHITECTURE. Aka IMAGE_DIRECTORY_ENTRY_GLOBALPTR. Aka IMAGE_DIRECTORY_ENTRY_TLS. Aka IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG. Aka IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT. Aka IMAGE_DIRECTORY_ENTRY_IAT. Aka IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT. Aka IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR. An object used to read PE (Portable Executable) and COFF (Common Object File Format) headers from a stream. Reads PE headers from the current location in the stream. Stream containing PE image starting at the stream's current position and ending at the end of the stream. The data read from stream have invalid format. Error reading from the stream. The stream doesn't support seek operations. is null. Reads PE headers from the current location in the stream. Stream containing PE image of the given size starting at its current position. Size of the PE image. The data read from stream have invalid format. Error reading from the stream. The stream doesn't support seek operations. is null. Size is negative or extends past the end of the stream. Gets the offset (in bytes) from the start of the PE image to the start of the CLI metadata. or -1 if the image does not contain metadata. Gets the size of the CLI metadata 0 if the image does not contain metadata.) Gets the COFF header of the image. Gets the byte offset from the start of the PE image to the start of the COFF header. Determines if the image is Coff only. Gets the PE header of the image or null if the image is COFF only. Gets the byte offset from the start of the image to Gets the PE section headers. Gets the CLI header or null if the image does not have one. Gets the byte offset from the start of the image to the COR header or -1 if the image does not have one. Determines if the image represents a Windows console application. Determines if the image represents a dynamically linked library. Determines if the image represents an executable. Gets the offset (in bytes) from the start of the image to the given directory entry. The section containing the directory could not be found. The section containing the Searches sections of the PE image for the one that contains specified Relative Virtual Address. Address. Index of the section that contains , or -1 if there is none. Portable Executable format reader. The implementation is thread-safe, that is multiple threads can read data from the reader in parallel. Disposal of the reader is not thread-safe (see ). Creates a Portable Executable reader over a PE image stored in memory. Pointer to the start of the PE image. The size of the PE image. is . is negative. The memory is owned by the caller and not released on disposal of the . The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the . The content of the image is not read during the construction of the Creates a Portable Executable reader over a PE image stored in a stream. PE image stream. is null. Ownership of the stream is transferred to the upon successful validation of constructor arguments. It will be disposed by the and the caller must not manipulate it. Creates a Portable Executable reader over a PE image stored in a stream beginning at its current position and ending at the end of the stream. PE image stream. Options specifying how sections of the PE image are read from the stream. Unless is specified, ownership of the stream is transferred to the upon successful argument validation. It will be disposed by the and the caller must not manipulate it. Unless or is specified no data is read from the stream during the construction of the . Furthermore, the stream must not be manipulated by caller while the is alive and undisposed. If or , the will have read all of the data requested during construction. As such, if is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the after construction. is null. has an invalid value. is specified and the PE headers of the image are invalid. Creates a Portable Executable reader over a PE image of the given size beginning at the stream's current position. PE image stream. PE image size. Options specifying how sections of the PE image are read from the stream. Unless is specified, ownership of the stream is transferred to the upon successful argument validation. It will be disposed by the and the caller must not manipulate it. Unless or is specified no data is read from the stream during the construction of the . Furthermore, the stream must not be manipulated by caller while the is alive and undisposed. If or , the will have read all of the data requested during construction. As such, if is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the after construction. Size is negative or extends past the end of the stream. Creates a Portable Executable reader over a PE image stored in a byte array. PE image. The content of the image is not read during the construction of the is null. Disposes all memory allocated by the reader. can be called multiple times (but not in parallel). It is not safe to call in parallel with any other operation on the or reading from s retrieved from the reader. Gets the PE headers. The headers contain invalid data. Returns a view of the entire image as a pointer and length. PE image not available. Return true if the reader can access the entire PE image. Returns false if the is constructed from a stream and only part of it is prefetched into memory. Gets a pointer to and size of the PE image if available (). The entire PE image is not available. Returns true if the PE image contains CLI metadata. The PE headers contain invalid data. Loads PE section that contains CLI metadata. The PE image doesn't contain metadata ( returns false). The PE headers contain invalid data. Loads PE section that contains the specified into memory and returns a memory block that starts at and ends at the end of the containing section. Relative Virtual Address of the data to read. An empty block if doesn't represent a location in any of the PE sections of this PE image. The PE headers contain invalid data. Reads all Debug Directory table entries. Bad format of the entry. Reads the data pointed to by the specified Debug Directory entry and interprets them as CodeView. is not a CodeView entry. Bad format of the data. By default the stream is disposed when is disposed and sections of the PE image are read lazily. Keep the stream open when the is disposed. Reads metadata section into memory right away. Reading from other sections of the file is not allowed ( is thrown by the ). The underlying file may be closed and even deleted after is constructed. closes the stream automatically by the time the constructor returns unless is specified. Reads the entire image into memory right away. closes the stream automatically by the time the constructor returns unless is specified. The name of the section. The total size of the section when loaded into memory. If this value is greater than , the section is zero-padded. This field is valid only for PE images and should be set to zero for object files. For PE images, the address of the first byte of the section relative to the image base when the section is loaded into memory. For object files, this field is the address of the first byte before relocation is applied; for simplicity, compilers should set this to zero. Otherwise, it is an arbitrary value that is subtracted from offsets during relocation. The size of the section (for object files) or the size of the initialized data on disk (for image files). For PE images, this must be a multiple of . If this is less than , the remainder of the section is zero-filled. Because the field is rounded but the field is not, it is possible for to be greater than as well. When a section contains only uninitialized data, this field should be zero. The file pointer to the first page of the section within the COFF file. For PE images, this must be a multiple of . For object files, the value should be aligned on a 4 byte boundary for best performance. When a section contains only uninitialized data, this field should be zero. The file pointer to the beginning of relocation entries for the section. This is set to zero for PE images or if there are no relocations. The file pointer to the beginning of line-number entries for the section. This is set to zero if there are no COFF line numbers. This value should be zero for an image because COFF debugging information is deprecated. The number of relocation entries for the section. This is set to zero for PE images. The number of line-number entries for the section. This value should be zero for an image because COFF debugging information is deprecated. The flags that describe the characteristics of the section. Used to modify the value of the property. CLS-compliant setters are named with set_ prefix. Used to read the value of the property. CLS-compliant getters are named with get_ prefix. Other method for property (not getter or setter) or event (not adder, remover, or raiser). Used to add a handler for an event. Corresponds to the AddOn flag in the Ecma 335 CLI specification. CLS-compliant adders are named with add_ prefix. Used to remove a handler for an event. Corresponds to the RemoveOn flag in the Ecma 335 CLI specification. CLS-compliant removers are named with remove_ prefix. Used to indicate that an event has occurred. Corresponds to the Fire flag in the Ecma 335 CLI specification. CLS-compliant raisers are named with raise_ prefix. Specifies the security actions that can be performed using declarative security. No declarative security action. Check that all callers in the call chain have been granted specified permission, The calling code can access the resource identified by the current permission object, even if callers higher in the stack have not been granted permission to access the resource. Without further checks refuse Demand for the specified permission. Without further checks, refuse Demand for all permissions other than those specified. Check that the immediate caller has been granted the specified permission; The derived class inheriting the class or overriding a method is required to have been granted the specified permission. The request for the minimum permissions required for code to run. This action can only be used within the scope of the assembly. The request for additional permissions that are optional (not required to run). This request implicitly refuses all other permissions not specifically requested. This action can only be used within the scope of the assembly. The request that permissions that might be misused will not be granted to the calling code. This action can only be used within the scope of the assembly. The Resource is exported from the Assembly The Resource is not exported from the Assembly Masks just the visibility-related attributes. Specifies all the hash algorithms used for hashing assembly files and for generating the strong name. A mask indicating that there is no hash algorithm. If you specify None for a multi-module assembly, the common language runtime defaults to the SHA1 algorithm, since multi-module assemblies need to generate a hash. Retrieves the MD5 message-digest algorithm. MD5 was developed by Rivest in 1991. It is basically MD4 with safety-belts and while it is slightly slower than MD4, it helps provide more security. The algorithm consists of four distinct rounds, which has a slightly different design from that of MD4. Message-digest size, as well as padding requirements, remain the same. Retrieves a revision of the Secure Hash Algorithm that corrects an unpublished flaw in SHA. Retrieves a version of the Secure Hash Algorithm with a hash size of 256 bits. Retrieves a version of the Secure Hash Algorithm with a hash size of 384 bits. Retrieves a version of the Secure Hash Algorithm with a hash size of 512 bits. The assembly reference holds the full (unhashed) public key. Not applicable on assembly definition. The implementation of the referenced assembly used at runtime is not expected to match the version seen at compile time. The assembly contains Windows Runtime code. Content type mask. Masked bits correspond to values of . Specifies that just-in-time (JIT) compiler optimization is disabled for the assembly. Specifies that just-in-time (JIT) compiler tracking is enabled for the assembly.