Question:
Hello. I am having some difficulty understanding the documentation and figuring out how to do the subject. My intent is to limit the extent to which third-party plugins for my application could potentially affect the user's computer.
The logical answer is to load plugins (in the form of DLLs) into an AppDomain specifically set up with limited trust, such that even if the plugin did attempt to perform some malicious activity, the OS would not allow it.
However, simple as this idea is, I am having trouble after trouble. Most recently I stumbled upon this gem in the documentation for AppDomain.Load():
"If the current AppDomain object represents application domain A
Answer1:
With .NET 3.5 comes the System.Addin library which tackles these kind of problems...
Tim Van Wassenhove - Please remember to mark the replies as answers if they help.
Answer2:
Good to know, however I'm using .NET 2.0 at the moment.
Answer3:
I think maybe you can write a proxy assembly loaded in both domains and let it load the assembly in the seperate domain.
And even you cannot use the Addin model, you can check out the CLR AddIn Model in Paint.Net series on Jason He's WebLog to adopt it's ideas.
Answer4:
Thanks I might check that out. In the meantime I seem to have gotten this to work, so long as the subclass of ICustomizerPlugin inherits from MarshalByRefObject:
Sponsor