afscrome / IronVelocity

A wrapper around NVelocity (a port of Apache Velocity) using the DLR to provide higher performance template execution.
MIT License
6 stars 1 forks source link

Member Accessibility differences between static and dynamic modes. #60

Open afscrome opened 8 years ago

afscrome commented 8 years ago

If you have a global variable that is a private class, accessing members of the variable will work fine in dynamic mode, but fail in static typed mode. This is because in dynamic mode, the member access happens in a DynamicMethod, which does not perform accessibility checks. In static type mode however, the member access occurs in a DynamicAssembly which does do accessibility checking. So the JIT will fail to compile the method.

See https://msdn.microsoft.com/en-us/library/9syytdak.aspx#Dynamic_Methods_Associated_with_Existing_Assemblies