Hi, It's quite simple, you have to use the Cecil type system instead of System.Reflection which is bound to the executing version.
Open the assembly containing Encoding.UTF8 you need with Cecil, and import its reference in your module. Best, Jb On Thu, Sep 20, 2012 at 6:19 PM, earlz <[email protected]> wrote: > Hi there, I've been trying to create a small project that basically will > intercept a call to a certain method in a WinRT application and replace the > call with a generated static method. > > Everything has been working great until now. I inject the code with a > regular desktop application. The problem is that I use > > il.Emit(OpCodes.Call, > Module.Import(typeof(System.Text.Encoding).GetMethod("get_UTF8"))); > > This generates the il > > call class [mscorlib]System.Text.Encoding > [mscorlib]System.Text.Encoding::get_UTF8() > > But, I appear to need it to generate > > call class [System.Text.Encoding]System.Text.Encoding > [System.Text.Encoding]System.Text.Encoding::get_UTF8() > > > > How do I go about adding a type reference to a built in assembly that isn't > in my injecting application? > > > > > -- > -- > mono-cecil -- -- mono-cecil
