Instrumenting IL generation in Mono’s C# compiler


Someone asked me the other day how I’d go about instrumenting the IL generated by the Mono C# compiler: something to do with custom profiling I think. I still haven’t come up with a totally satisfactory answer but here’s a patch of some work I did showing how I hacked away at various bits of the sources to emit custom method prologues and epilogues. Download the patch and apply it to your Mono Git repo.

Here is a Stack Overflow question I asked about the preferred method of extending the C# compiler. This relates to my plan to do very spiffy things to mcs’s ASTs and type checker!

Tags: Mono, C#

All content © 2018 Richard Cook. All rights reserved.