I am trying to create an isolated AppDomain for loading extensions / plugins. I have a MarshalByRefObject which in the instance inside appdomain loads the dll. I get SecurityExceptions when I try to load DLLs, and I cannot figure out how to get around them, still limiting what third-party code can do. All my projects are.net 4.
The InDomainLoader class is in a fully trusted domain, this method is marked as SecuritySafeCritical. From everything I read, I think it should work.
Here is my Loader class that creates the AppDomain and jumps into it:
public class Loader { public void Load(string dll, string typeName) { Log.PrintSecurity();
And here is the bootloader that runs in the domain:
public class InDomainLoader : MarshalByRefObject { [SecuritySafeCritical] public void Load(string dll, string typeName) { Log.PrintSecurity(); var assembly = Assembly.LoadFrom(dll);
Some registration statements report that the IsFullyTrusted assembly is true and the method has both IsSecurityCritical and IsSecuritySafeCritical true, IsSecurityTransparent false.
I pinned the entire project to http://davidhogue.com/files/PluginLoader.zip in case this makes it easier.
If anyone has any ideas, I will be very grateful. I seem to be stuck in a dead end.
source share