After a lot of trial and error I found the answer:
Any ValueType-object that is passed boxed as an object to the DynamicMethod factory has to be (in IL) first loaded to the stack as a value from the argument, then unboxed, then stored to a local variable declared as the ValueType, and finally loaded as a reference to the stack.
Then the method call can be invoked on the boxed object reference.
this is the code...
User Profile
Collapse
-
C#: IL/Emit: DynamicMethod and DateTime problem
Hi,
I am working in C# with an Object / Relational Database mapping framework, where I want to generate method calls based on string representation of the call signature.
I have used reflection and Method-/Field-/PropertyInfo invokation to do this, but now I want to make the calls faster by using Emit and DynamicMethods
I am now trying to create a factory method that creates a dynamic method as a "wrapper" around...
No activity results to display
Show More
Leave a comment: