Make DynamicMethod invokable "directly" #68135
-
Hi all, code like the below currently fails: var dm = new DynamicMethod(...); // emit some IL
var type = module.DefineType(...);
var mb = type.DefineMethod(...);
mb.GetILGenerator().Emit(OpCodes.Call, dm);
type.CreateType().GetMethod(...).Invoke(...); // exception: Unable to import a global method or field from a different module Looking at the code, there is GetMethodTokenNoLock method and it doesn't support Currently I end up having to create a delegate, store it in a static field somewhere, and then call the delegates |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@dotnet/area-system-reflection-emit |
Beta Was this translation helpful? Give feedback.
-
Opened #68791. |
Beta Was this translation helpful? Give feedback.
Opened #68791.