Jun 19, 2007

Runtime Assembly Instrumentation Library

This project plans to implement an API that allows CLR assemblies to be manipulated and instrumented before they are loaded and executed.
In the CLR, the AppDomain class and the ResolveEventHandler event handler already provide an excellent mechanism for dynamically loading assemblies into an application domain under the control of the programmer. At the same time, the reflection capabilities of the CLR are extremely powerful. Not only it is possible to query the existing types at runtime, but is also possible to define new assemblies in memory and use Reflection.Emit to generate MSIL on-the-fly. Our plan is to fill the gap between these two concepts. The idea is to have an API that allows the programmer to intercept the class resolution process, examining and manipulating the code that exists in an assembly, before the code is actually defined on the virtual machine. This API will be called RAIL: Runtime Assembly Instrumentation Library.
By using RAIL it will be possible to specify specific transformations that must be done at an assembly before it is loaded and executed. These transformations will be specified using a high-level API, abstracting the programmer from the low-level details of MSIL and the assembly binary format. For instance, it will be possible to substitute the references to a class for references to another class, change the name and usage of constants and variables, examine and change existing methods, and so on.

Source : http://rail.dei.uc.pt/index.htm