SecurityException in PluginFinder!?

Dec 16, 2008 at 4:20 PM
Hi!

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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

Any ideas would be appreciated! :)

Jan 19, 2009 at 8: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 6: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!

BR,
Martin

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);
            Assign(this.Plugins);

            //AppDomain.Unload(domain);            
        }

Coordinator
Jan 20, 2009 at 7:21 AM
Edited Jan 20, 2009 at 7: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.