General Discussion

IL Injection

Started by albertomonteiro on 10,890 views

I was testing my "small" aop framework
https://github.com/AlbertoMonteiro/ThrowHelper
I injected IL after build, and I was trying to tests Instructions count with Mono.Cecil, but something was wrong, the instruction count was very higher than should be, so I dissabled it and saw that you inject some NCrunch calls, whats the purpose?
Hi,

This is due to the instrumentation that NCrunch introduces in order to analyse code coverage at runtime. You can turn off instrumentation in your NCrunch project configuration, but note that by doing this you will lose code coverage for the entire project. My suggestion would be to use an "#if NCRUNCH" directive to introduce alternative behaviour for your test while it is running under NCrunch.


Cheers,

Remco
Yeah, I saw here:
https://gist.github.com/2817057
Thats very nice!!!
Btw, I love Mono.Cecil!!!

I changed the logic test.
Now I test the added instruction instead of testing the total number of instructions, thus, no need to worry about the code inserted by him

Edited

This post has been deleted.
This post has been deleted.
This post has been deleted.
This post has been deleted.
This post has been deleted.
This post has been deleted.

Post a reply

Log in to reply.