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
crate::metadata::typesystem::CilType: Core type representation combining TypeDef, TypeRef, and TypeSpeccrate::metadata::typesystem::TypeRegistry: Central registry for all types in an assemblycrate::metadata::typesystem::TypeResolver: Resolves type references and builds complete type informationcrate::metadata::typesystem::TypeBuilder: Builder pattern for constructing complex typescrate::metadata::typesystem::CilPrimitive: Built-in primitive types (int32, string, object, etc.)
§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§
- Array
Dimensions - 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.
- CilType
Ref - A smart reference to a
CilTypethat uses weak references to prevent circular dependencies. - Type
Builder - A fluent builder for constructing .NET type specifications.
- Type
Registry - Central registry for managing all types within a .NET assembly.
- Type
Resolver - Converts abstract type signatures into concrete type instances.
Enums§
- CilFlavor
- Represents the different categories and flavors of types in the .NET type system.
- CilPrimitive
Data - Type-safe storage for constant primitive values.
- CilPrimitive
Kind - Classification of all .NET primitive types from ECMA-335.
- CilType
Reference - Represents a unified reference to various metadata table entries in the .NET runtime.
- Type
Source - Classification of type origins within the .NET assembly ecosystem.
Type Aliases§
- CilType
List - A vector that holds a list of
CilTypereferences. - CilType
Rc - Reference-counted pointer to a
CilType. - CilType
RefList - A vector that holds
CilTypeRefinstances (weak references).