>> Sure, but peverify reports many more errors than the runtime verifier. >> Does the runtime execute the code, even if peverify complains? > > So yeah, SRE let you emit such code, and the runtime will execute it. > But if you save the assembly using SRE, you'll get the exact same > peverify error.
Therefore, it's a good idea to do the following (<http://msdn.microsoft.com/en-us/library/bs22fky4.aspx>): "During the development of code that emits dynamic assemblies, it is recommended that you use an overload of the DefineDynamicAssembly method that specifies evidence and permissions, supply the evidence you want the dynamic assembly to have, and include SecurityPermissionFlag..::.SkipVerification in refusedPermissions. Including SkipVerification in the refusedPermissions parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes SecurityException to be thrown when used with code that demands full trust." (Unless you need to demand full trust, of course.) Fabian --~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~---
