Thursday, December 09, 2004 4:45 PM
by
NazimMS
MSIL code/fault injection using .NET profiling APIs
Recently I have been looking into painless ways to do some amount of code injection for MSIL for fault tolerance and security testing. One of my requirements was to be able to do this dynamically. I had found some tools that would do it statically by creating wrapper dlls that would use Reflection, but these were a pain to use and had severe limitations (and bugs).
I found a link to this article on one of my google excursions and it caught my attention: Rewrite MSIL Code on the Fly with .Net Framework Profiling API by Aleksandir Mikunov. Besides being an exhaustive article, it certainly gives me ideas on approaching the whole dynamic fault injection space ...
Since the profiler can intercept the JIT compilation process, I could insert a custom prologue that would contain trigger logic to either execute the method or fail as I would want it to. It seems feasible enough ... but of course I haven't tried this out yet.
I am sure someone else has already thought about this ... so what I am now wondering if someone out there has already attempted a tool like this. If not ... hey, I have my next December project !