Weaving .net assemblies

Weaving refers to the process of injecting functionality into an existing program. This can be done conceptually at a number of levels:

  • Source code weaving would inject source code lines before the code is compiled
  • IL weaving (for .NET) adds the code as IL instructions in the assembly
  • ByteCode weaving (for Java) works on the class file, see these comments wrt AspectJ

In theory you could go one deeper and weave with an executable compiled to native instructions, but this would add a lot of complexity and I’m not aware of anything that does this.