views:

133

answers:

1

I try to lead the types from an .dll (which is also referenced in the executing project). I call:

    public static void LoadPlugin(string pluginFile)
    {
        Assembly assembly = Assembly.LoadFrom(pluginFile);

        foreach (Type type in assembly.GetTypes())
        {
            // play with it
        }
    }

It loads just a few of them:

public partial class Mathematics : UserControl, IMathematics, IPortable

and

public partial class Welcome : UserControl

but the next one, and some others, are ignored:

public partial class Test : UserControl, ITest, IPortable

They all stand in the same assembly, under the same namespace. The public static void LoadPlugin(string pluginFile) method is located in other assembly that is also referenced in the executing project.

No exceptions are thrown. What could be the issues for not loading all the types? Any ideas?

+1  A: 

Are the types not loaded inheriting from a third assembly that isn't referenced correctly from the calling assembly?

ck
Hi, and thanks for reply.I am using 2 assemblies: 1. containing the types that I'm interested in. This project has a reference in the executing project.2. a project that contains logic for loading assemblies. This one has a reference in the no. 1. project and also in the executing project.I just reconstructed the project (delete everything and then new project, added files containing classes, etc.). Now, for some reason, I can get some of the types that I didn't got before reconstructing. Also, some of the types that I got before, are not visible anymore.Where am I doing wrong?
meta