IL rewriting

Generating and rewriting .NET assemblies at the IL level with Mono.Cecil.

  1. Mono.Cecil: SimplifyMacros and OptimizeMacros

    What SimplifyMacros and OptimizeMacros do in Mono.Cecil, and why rewriting a method should start with one and end with the other.

    IL rewritingCLR internals1 min read

  2. Mono.Cecil: Generics

    Importing and instantiating a generic type with Mono.Cecil, and why the method reference’s declaring type must be the generic instance.

    IL rewritingCLR internals1 min read

  3. Mono.Cecil: IAssemblyResolver

    What IAssemblyResolver does in Mono.Cecil, and why real projects should give the reader one shared, custom resolver.

    IL rewriting1 min read

  4. Mono.Cecil: Nothing stops you (well, almost)

    Mono.Cecil follows the CLI rules rather than the C# rules, so it can do things C# forbids, such as giving a method a name that is illegal in C#.

    IL rewritingCLR internals1 min read

  5. Mono.Cecil: Hello, World

    A minimal Mono.Cecil program that creates an assembly from scratch, with one type and a method that prints Hello World.

    IL rewriting2 min read

  6. Mono.Cecil: An overview

    An introduction to Mono.Cecil: what it offers over Reflection.Emit, the difference between references and definitions, and the core types of its object model.

    IL rewriting3 min read