The difference between BeforeInstrumentMethod & InstrumentMethod
robertpi opened this issue · comments
Hello all,
I'm unclear on the difference between BeforeInstrumentMethod
, InstrumentMethod
. It seems both are called if ShouldInstrumentMethod
sets pbInstrument to true, the signatures are the same and both can be used for rewriting methods. So, it's unclear which I used use for my rewrites. I noticed the "Nagler" example / test uses both to preform different kinds of instrumentation, but it's unclear why it does this.
Also, is this the correct forum for design questions? I'll probably have some more questions.
Thanks,
Robert
The recommended way to instrument is to use InstrumentMethod
. BeforeInstrumentMethod
is used for whole method body replacement. In this scenario, one InstrumentationMethod will replace the entire method body (along with new IL offset maps) while other instrumentation methods will make incremental changes. See
Please feel free to post more questions in this repo.
Thanks, that's really helpful!