DynamicMethod constructor

Apr 5, 2009 at 9:12 AM
Edited Apr 5, 2009 at 9:13 AM
Hello :)
Seems like your library should work on .NET Framework 2.0, but you use DynamicMethod with signature:
public DynamicMethod(
string name,
Type returnType,
Type[] parameterTypes

that was presented in Framework 3.5, so library don't works on PCs with installed .NET Framework 2.0 without service packs...
You can found small hint about this situation in MSDN at DynamicMethod constructor page:

"This constructor was introduced in the .NET Framework version 3.5. For more information, see .NET Framework 3.5 Architecture."

If you present one more boolean true parameter for the all constructors calls,
it makes compilation much faster (skipping JIT visibility checks) and FLEE will work at all .NET 2.0.

p.s. Sorry me my English...
Apr 8, 2009 at 2:00 AM
Thanks for the tip.  I switched to an anonymously hosted dynamic method a while ago and later realized (after some people posted some comments) that you needed .NET 2.0 SP1 for it to work.  I think I'll put it back as nobody has yet had issues with running Flee in a partial-trust setting.

>it makes compilation much faster (skipping JIT visibility checks)
This is what MSDN has to say about the skip visibility parameter:
Skipping the JIT compiler's visibility checks allows the dynamic method to access private and protected members of all other types as well. This is useful, for example, when writing code to serialize objects.

Basically, this would enable Flee's expressions to have access to all members of all types.  Right now, Flee only allows access to non-public members on the expression owner.  I think it's a good idea to leave this flag to false so that even if Flee has a bug it's member access logic, the framework will catch it.  I also didn't notice any compilation speed gains with this flag set when running through the demo.