Module typesystem

Expand description

Implementation of the .NET type system .NET type system implementation for CIL analysis.

This module provides a complete representation of the .NET type system, including type definitions, references, generics, arrays, and primitive types. It bridges the gap between raw metadata tables and a usable type system for analysis.

§Key Components

§Type System Features

  • Unified representation: Combines metadata from multiple tables
  • Generic support: Full generic type and method parameter handling
  • Array types: Multi-dimensional and jagged array support
  • Inheritance: Type hierarchy and interface implementation tracking
  • Primitive mapping: Automatic mapping to runtime primitive types
  • Reference resolution: Resolves cross-assembly type references

§Examples

use dotscope::{CilObject, metadata::typesystem::TypeRegistry};

let assembly = CilObject::from_file("tests/samples/WindowsBase.dll".as_ref())?;
let type_registry = assembly.types();

// Look up a specific type
for entry in type_registry.get_by_fullname("System.String") {
    println!("String type: {} (Token: 0x{:08X})",
        entry.name, entry.token.value());
}

Modules§

ELEMENT_TYPE
Constants representing .NET metadata element types as defined in ECMA-335.

Structs§

ArrayDimensions
Represents a single dimension of a multi-dimensional array with optional size and bounds.
CilModifier
Represents a type modifier that can be applied to .NET types.
CilPrimitive
Complete primitive type representation with optional constant data.
CilType
Represents a unified type definition combining information from TypeDef, TypeRef, and TypeSpec tables.
CilTypeRef
A smart reference to a CilType that uses weak references to prevent circular dependencies.
TypeBuilder
A fluent builder for constructing .NET type specifications.
TypeRegistry
Central registry for managing all types within a .NET assembly.
TypeResolver
Converts abstract type signatures into concrete type instances.

Enums§

CilFlavor
Represents the different categories and flavors of types in the .NET type system.
CilPrimitiveData
Type-safe storage for constant primitive values.
CilPrimitiveKind
Classification of all .NET primitive types from ECMA-335.
CilTypeReference
Represents a unified reference to various metadata table entries in the .NET runtime.
TypeSource
Classification of type origins within the .NET assembly ecosystem.

Type Aliases§

CilTypeList
A vector that holds a list of CilType references.
CilTypeRc
Reference-counted pointer to a CilType.
CilTypeRefList
A vector that holds CilTypeRef instances (weak references).