One thought on “Bug in Mono.Cecil”

Cecil is being developed and maintained. And the bug is not directly in Cecil, but in how you use it. You’re injecting code inside a branch which is a short form, and hence the offset offerflows. Call .Simplify () on the MethodBody before instrumenting it, and call Optimize () on it when you’re done. Here, the «bug» is gone.