lundi 5 janvier 2015

How to grant CodeAccessPermission

I have an assembly with a method that I want to grant the MemberAccess ReflectionPermission. The MSDN says I can "grant that permission", but it not clear how to do it. I tried initializing an instance and calling Demand. It didn't throw an exception when I called Demand, but I still get an exception when I try to access private members of other classes.



Dim reflectionPermission As New ReflectionPermission(PermissionState.Unrestricted)
reflectionPermission.Demand()


I also considered creating a sandbox AppDomain w/ the permission set, but I need to be able to interact w/ the code running w/ the reflection permission.






Aucun commentaire:

Enregistrer un commentaire