This project is read-only.

SecurityException in PluginFinder!?

Dec 16, 2008 at 5:20 PM

When I run PluginManager.Start(), I get a  security exception (full excption is below). Debugging shows that it originates from this line:

PluginFinder finder = (PluginFinder)domain.CreateInstanceFromAndUnwrap(GetType().Assembly.Location ?? string.Empty, GetType().Namespace + ".PluginFinder");

Any ideas about what can be source of this problem?

Full exception:

"Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

Any ideas would be appreciated! :)

Jan 19, 2009 at 9:28 PM
I am having the same issue.
I think it relates to having the fadd libraries in a separate assembly to the project in which you are loading your plugins into. I have not had a chance yet to test this theory- but are you also doing the same thing?
Did you manage to resolve the issue? I will post back here if I resolve it.
Jan 20, 2009 at 7:56 AM
I changed my Find function in PluginFinder.cs as below. It works now but is probably suboptimal. If you find a better solution, please post it!


public void Find(string fullPath, IEnumerable<Type> types)
            AppDomain domain = AppDomain.CreateDomain("ModuleLoader");

            string test = GetType().Assembly.Location;

        //    PluginFinder finder = (PluginFinder)domain.CreateInstanceFromAndUnwrap(
        //                                            GetType().Assembly.Location ?? string.Empty, GetType().Namespace + ".PluginFinder");

            FindInternal(fullPath, types);

          //  finder.FindInternal(fullPath, types);


Jan 20, 2009 at 8:21 AM
Edited Jan 20, 2009 at 8:23 AM
First google result when searching for "CreateDomain FileIOPermission":

Searching for plugins in the primary appdomain will load _ALL_ dlls into your application, and they will remain there during your programs lifetime.