Jitex
Jitex copied to clipboard
Hook Encoding.GetString
I want to hook the two methods of System.Text.Encoding.
public virtual string GetString(byte[] bytes) public virtual string GetString(byte[] bytes, int index, int count)
JitexManager.MethodResolver += context =>
{
Trace.WriteLine($"{context.Method.DeclaringType.Name} {context.Method.Name}" );
};
There is no output of the two methods. And I try to do the following:
var methods = Type.GetType("System.Text.Encoding").GetMethods().Where(w => w.Name == "GetString");
foreach (var method in methods)
{
MethodHelper.ForceRecompile(method); //Force recompile
}
And the app just crashes.
Could you pls show me a good example? Thank you!