Defines the elements of a CLI module.

Classes

  Class Description
AssemblyEnvelope
Represents an assembly understood basically, internally, as a collection of modules (ModuleDeclaration) and, externally, as a collection of exported types.
AssemblyLoadHelper
Helper class to load assemblies. Provides a "binding log" for our custom binder and appends this log in exception text.
AssemblyManifestDeclaration
Represents an assembly manifest (Assembly).
AssemblyRefDeclaration
Represents a reference to an external assembly (AssemblyRef).
AssemblyResolveEventArgs
Arguments of the AssemblyResolve event.
BindingException
Exception thrown when a binding exception occurs in PostSharp.
CustomAttributeConstructorException
Wraps any exception thrown during the construction of a custom attribute runtime instance.
CustomAttributeDeclaration
Represents a custom attribute (CustomAttribute).
DataSectionDeclaration
Represents a data section, where initial values of fieds are stored.
Declaration
Base type for all declarations of a module.
DeclarationCache
Caches some frequently-used declarations or constructions with lazy loading.
Domain
A domain is a scope, i.e. a context in which external references are resolved. A domain contains assemblies.
Element
Represents an element of a tree structure.
EventDeclaration
Represents an event (Event).
ExceptionHandler
Represents an exception handler.
ExportedTypeDeclaration
Represents a type exported by the current assembly but not defined in the current module.
FieldDefDeclaration
Represents a field definition (FieldDef).
FieldRefDeclaration
Represents a reference to a field of a type defined in an external assembly(MemberRef).
GenericParameterDeclaration
Represents a generic parameter (GenericParam).
Instruction
Gives read-only access to the current instruction of an InstructionReader.
InstructionBlock
A single node of the hierarchical structure of a method body.
InstructionReader
Reads a stream of binary IL instructions and debugging sequence points.
InstructionReaderBookmark
Bookmark for the InstructionReader class.
InstructionSequence
Represents a sequence of instructions without branches, i.e. the control flow necessarly begins at the beginning of the sequence and ends at the end of the sequence.
InstructionWriter
writer a linear stream of instructions into an InstructionSequence.
LocalVariableDeclaration
Represents a local variable. Local variables are owned by method bodies (MethodBodyDeclaration).
LocalVariableSymbol
Assigns a name to a local variable LocalVariableDeclaration. Local variable symbols belong to an InstructionBlock, which is in the current case the lexical scope of the variable.
ManifestFileDeclaration
Represents a file reference (File).
ManifestResourceDeclaration
Represents a resource referenced by the assembly (ManifestResource).
MarshalType
Marshal types. Determines how fields and parameters are marshalled during PInvoke.
MemberRefDeclaration
Represents a reference to a field or method (MemberRef). This type is the base of FieldRefDeclaration and MethodRefDeclaration.
MemberValuePair
Represents the fact that a member is assigned a value.
MetadataDeclaration
Base class for all declarations represented in the metadata tables. Metadata declarations have a token (MetadataToken) and may have custom attributes (CustomAttributeDeclaration).
MetadataDeclarationTables
Exposes the metadata tables.
MethodBodyDeclaration
Represents the IL body of a method.
MethodDefDeclaration
Represents a method definition (MethodDef).
MethodGroupDeclaration
Implements the functionalities that are common to PropertyDeclaration and EventDeclaration, which are both lexical collections of method semantics (MethodSemanticDeclaration).
MethodRefDeclaration
Represents a method reference.
MethodSemanticDeclaration
Represents a method semantic (MethodSemantic), i.e. the association of a method and a role in a collection (PropertyDeclaration or EventDeclaration).
MethodSignature
Represents a method signature, which specifies primarly a calling convention and the type of parameters.
MethodSpecDeclaration
Represents a method specification (MethodSpec), i.e. the construction of a concrete generic method.
ModuleDeclaration
Represents a module (Module).
ModuleRefDeclaration
Represents a reference to another module in the same assembly (ModuleRef).
NamedDeclaration
Extends the MetadataDeclaration class with a Name property.
OpCodeDictionary<(Of <(T>)>)
Efficient implementation of a dictionary taking an OpCodeNumber as the key type.
OpCodeMap
Maps OpCodeNumber to OpCode and provides the various properties of opcodes.
ParameterDeclaration
Represents a method parameter (ParamDef).
PermissionDeclaration
Represents a permission attribute.
PermissionSetDeclaration
Represents a permission set (Permission).
PInvokeMap
Maps a method declaration to an external unmanaged method.
PlatformInfo
Contains the characteristics of a platform, typically the target platform of the module.
PropertyDeclaration
Represents a property (Property).
RawUnmanagedResource
Unmanaged resource given in raw form, as an array of bytes.
SerializationType
Represents the type of a serialized value.
SerializedValue
Represents a serialized value and stores enough information to serialize it back using the exact representation.
StandaloneSignatureDeclaration
Represents a stand-alone signature (Signature).
SymbolSequencePoint
Maps a point in IL instructions to location in source code.
TypeDefDeclaration
Represents a type.
TypeRefDeclaration
Represents a type reference (TypeRef).
TypeSignature
Represents a type construction (pointer, array, generic type instance, intrinsic, ...).
TypeSignatureCollection
Collection of types (IType).
TypeSpecDeclaration
Represents a type specification (TypeSpec).
UnmanagedResource
Abstract class representing an unmanaged (Windows) resource. The only current implementation is RawUnmanagedResource, but later versions may provide implementations for specific types of resources.

Structures

  Structure Description
GenericMap
Map generic arguments to their value.
LiteralString
Encapsulates a read-only array of characters.
MetadataToken
Encapsulates a metadata token, which unambigously identifies a MetadataDeclaration inside a ModuleDeclaration.
UncompressedOpCode
Uncompressed opcode (i.e. an opcode with its operand).
UnmanagedResourceName
Represents the name or the type of an UnmanagedResource, which can consist either in a string, either in an integer.

Interfaces

  Interface Description
IAssembly
Defines the semantics of an assembly (AssemblyRefDeclarationAssemblyEnvelope).
IAssemblyName
Defines the semantics of an assembly name.
ICustomAttributeInstance
Exposes the fact that a custom attribute (ICustomAttributeValue) is applied to an element (MetadataDeclaration).
ICustomAttributeValue
Defines the semantics of a custom attribute value, i.e. basically a constructor, its arguments and other named arguments.
IDeclaration
Exposes the semantics of a declaration, which is basically a module-scoped domain element.
IElement
Defines the semantics of a domain element, which is basically a domain-rooted tree node.
IField
Defines the semantics of a field (FieldDefDeclaration, FieldRefDeclaration).
IGeneric
Exposes the common semantics to generic instances and generic definitions.
IGenericDefinition
Exposes the semantics of a generic definition (i.e. a type or method having (unbound) generic parameters).
IGenericInstance
Exposes the semantics of a generic instance (i.e. an instance of generic definition, with concretely specified generic, bound arguments).
IGenericMethodDefinition
Declares the semantics of a generic method definition, i.e. a method that may have unbound generic parameter and method constructions (MethodSpecDeclaration).
IGenericParameter
Defines the semantics of a generic parameter or argument.
IManifestResourceImplementation
Defines the semantics that are common to all physical locations that can contain resources (ManifestResourceDeclaration).
IMember
Defines the semantics of a type member (DeclaringType and Name properties).
IMemberRefResolutionScope
Defines semantics of all classes declaring external fields or methods.
IMetadataDeclaration
Defines the semantics of a metadata declaration, i.e. a declaration with a token.
IMethod
Defines the functionalities that are common to all representations of a method (MethodDefDeclaration, MethodRefDeclaration, MethodSpecDeclaration).
IMethodSignature
Exposes the semantics of a method signature.
IModule
Defines the functionalities that are common to all representations of a module (ModuleDeclaration, ModuleRefDeclaration).
IModuleScoped
Defines a Module property.
INamedType
Defines the semantics of a type (IType) that can be named.
IRemoveable
Defines the semantics of a declaration that can be removed from its parent.
ISecurable
Defines semantics of declarations that can be secured by permission sets (TypeDefDeclaration, MethodDefDeclaration, AssemblyManifestDeclaration).
IType
Defines the semantics of a type.
ITypeContainer
Exposes the semantics of a declaration that can contain type definitions (ModuleDeclaration or TypeDefDeclaration).
ITypeRefResolutionScope
ITypeSignature
Defines the functionalities that are common to all representations of a type (TypeDefDeclaration, TypeRefDeclaration, TypeSpecDeclaration, TypeSignature).
IWeakReferenceable
Defines the semantics of declarations (TypeRefDeclaration and AssemblyRefDeclaration) that can be "weakly references".

Delegates

  Delegate Description
DeclarationCacheCallback
Specifies the method that is called by DeclarationCache when a content is requested.
InstructionAction
Represents an action that performs an action on the current instruction of a specified InstructionReader.

Enumerations

  Enumeration Description
AssemblyRefAttributes
Options of assembly references (AssemblyRefDeclaration).
BindingOptions
Determines how the binding methods behave when the requested object is not found.
CallingConvention
Determines the calling convention of methods.
GenericContextOptions
GenericParameterKind
Enumerates the kind of classes accepting generic parameters.
ImageAttributes
Attributes of a .NET PE module.
InstructionPrefixes
Enumeration of IL prefixes.
IntrinsicType
Enumeration of primitive types of the .NET runtime. This includes intrincic types.
MemberKind
Enumerates the kinds of type members.
MethodSemantics
Enumerates the method semantics.
OpCodeNumber
Enumeration of all opcode numbers.
PInvokeAttributes
P-Invoke attributes.
ReflectionNameOptions
StandaloneSignatureKind
Enumerates the kind of stand-alone signatures (StandaloneSignatureDeclaration).
TokenType
Specifies the type of metadata token.
TypeClassifications
Type classifications are predicate that applies on types.
TypeNakingOptions
Determines the behavior of the GetNakedType(TypeNakingOptions) method.
UnmanagedResourceType
Types of unmanaged resources (like Accelerator, Icon, ...).
Visibility
Visibity of types and type members.

Remarks

A CLI module can be represented as a tree of elements whose root is ModuleDeclaration. Each tree leave derives from the Declaration class.

The most interesting is probably the following: the ModuleDeclaration contains types (TypeDefDeclaration), which contain methods, fields, properties and events. The MethodDefDeclaration has a Body()()() property, which contains the IL implementation of the method (MethodBodyDeclaration).

A method body is a tree of instruction blocks (InstructionBlock). Instruction blocks can be for instance protected blocks (try {..} blocks) or lexical scopes. Instruction blocks are composed of instruction sequences (InstructionSequence), which are streams of instructions with linear execution (without branching instructions inside).

Instruction sequences can be written thanks to an InstructionReader or written using an InstructionWriter.