« Visual Studio .NET 2003 solution files with corrupted source control settings | Main | Hashing with Salt, SHA-1, Base64, MD5 »

Permission Requests

Since the syntax of permission requests is obscure and poorly documented, here’s a list of references:

[assembly:EnvironmentPermissionAttribute(SecurityAction.RequestMinimum, Read="USERNAME")]

[assembly:FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)]

[assembly:IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UserQuota=1048576)]

[assembly:SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode=true)]

[assembly:FileIOPermission(SecurityAction.RequestOptional, Unrestricted=true)]

 

Using System.Reflection.GetConstructor() was failing (returning null) for a type with a public default constructor because declarative security in the Assembly.cs file was denying FileIOPermission. With Unrestricted=true FileIOPermission it works fine. Doesn’t seem to need MemberAccess=true on ReflectionPermission. Oddly, over 500 MemberInfo instances were returned by a call to GetMembers at the same time the GetConstructor & GetConstructors calls were returning nothing. Tested whether it mattered that the constructor was accessing the file system. It did not.

 

[assembly:ReflectionPermission(SecurityAction.RequestMinimum,MemberAccess=true)]

[assembly:FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)]

 

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)