Hi,

while working on an updated version of mono.merge using cecil 0.9, I'm having a hard time cloning SecurityDeclarations on methods (maybe on other objects, too). I'm merging a 3rd party assembly with a SecurityDeclaration on a method with the following ildasm layout:

.permissionset linkcheck "<PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\">\r\n <IPermission class=\"System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"\r\n version=\"1\"\r\n PublicKeyBlob=\"002400000480000094000000060200000024000052534131000400000100010071E9D3E8FB4B521B04EA8F76D94C5FE657793FF51E88DD9DD1AD6D056525454770A74B63478A1B63ED2AD979E65BEE25DE44BA686242CE430F0C7DF1475C18BEB5467555F740961A969E5E411CA4567C73B471F32815041356C9A106309D46EF9F232CB4BB0B0746475B5DB8CE1D4FCF17D99A80A0F7205DFD03D43B109583C2\"/>\r\n</PermissionSet>\r\n"

but after merging, I get this:

.permissionset linkcheck = {class 'System.Security.Permissions.PermissionSetAttribute' = {property string 'XML' = string('<PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\">\r\n <IPermission class=\"System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"\r\n version=\"1\"\r\n PublicKeyBlob=\"002400000480000094000000060200000024000052534131000400000100010071E9D3E8FB4B521B04EA8F76D94C5FE657793FF51E88DD9DD1AD6D056525454770A74B63478A1B63ED2AD979E65BEE25DE44BA686242CE430F0C7DF1475C18BEB5467555F740961A969E5E411CA4567C73B471F32815041356C9A106309D46EF9F232CB4BB0B0746475B5DB8CE1D4FCF17D99A80A0F7205DFD03D43B109583C2\"/>\r\n</PermissionSet>\r\n')}}

So it seems like cecil has problems with copying such SecurityDeclarations. What I do in the merge process is simply copying the SecurityDeclaration by cloning it (creating a new one and adding all fields and properties, which are cloned, too). However, the above result is the same when just copying the SecurityDeclaration from the original assembly.

Pure roundtripping (read assembly with ReadingMode.Immediate, write to another location) works, but I guess cecil does not touch the SecurityDeclarations in this case?

If you need a repro, let me know. Any help greatly appreciated :-)

Simon

--
--
mono-cecil

Reply via email to