SecurityException from Activator.CreateInstance(), How to grant permissons to Assembly?
- by user365164
I have been loading an assembly via Assembly.LoadFrom(@"path"); and then doing
Type t = asm.GetType("Test.Test");
test = Activator.CreateInstance(t, new Object[] { ... });
and it was working fine, but now I moved the dll I am getting the following
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --- System.Security.SecurityException: Request for the permission of type 'System.Security.Permissons.SecurityPermission, etc ..
For the sake of brevity it seems the demand was for an PermissionSet that allowed ControlAppDomain and it's not getting it.
My question is how can I create this permissionset and pass it to the instance or assembly?
I've been googling for hours to no avail.