In .Net 4 some methods are now decorated with different security attributes than they were in previous versions (ie the new SecurityCriticalAttribute). In order to override methods with security permissions the relative security accessibilities on the derived declaration must match those on the base declaration (or else a runtime exception).
Legacy assemblies will have no knowledge of these new attributes, and, as the code is already compiled and the metadata already generated, we cannot load any type from those assemblies that overrides a method that now has the new attribute (as the security accessibilities do not match).
Is .Net4 intended to be compatible with pre .Net4 assemblies? If so is t开发者_JAVA技巧here a workaround/solution for this?
I haven't stumbled on this one before but after some research it seems that there is legacy support by using the NetFx40_LegacySecurityPolicy
option.
<configuration>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true" />
</runtime>
</configuration>
精彩评论