Is there anyway to update IL instructions to use new local variable indexes? #768
-
I am trying to inject a method into another method. Problem is the local variables indexes. Example-
I want to inject method1 into method2 but the problem is it throws invalid IL code because for method1 local variable at index 0 is of type string and for method2 local variable at index 0 is of type int. What I do is I fetch method1 methodDefinition and takes its instructuions through-
I add the local variables of method1 to method2 variables list and also insert instructions before it. But I know its wrong IL code because of the local variables index issue. So, How can I fix it without writing the IL code myself? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, I'm afraid there's nothing built-in. You're going to have to fix the IL yourself to merge the bodies. |
Beta Was this translation helpful? Give feedback.
Hello,
I'm afraid there's nothing built-in. You're going to have to fix the IL yourself to merge the bodies.