Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assembly.GetTypes() does not return all types

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?

like image 934
meta Avatar asked Sep 10 '26 18:09

meta


1 Answers

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

like image 115
cjk Avatar answered Sep 12 '26 06:09

cjk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!