I try to get all classes implementing an interface with this method:
private static IEnumerable<Type> GetDriverClasses()
{
var type = typeof(IDeviceDriver);
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => type.IsAssignableFrom(p) && p.IsClass && !p.IsAbstract);
return types;
}
This works as long as an instance of the class has been created. else it fails.
How to get a class without having to create an instance first?
Additional info:
DllSetup:
Core.dll holds the class with the above method
Impl.dll references Core and holds the class to find
Test.dll references both and calls the method
It seems connected to how assemblies are loaded as creating an instance of a dummy class in Impl.dll also makes the other class find-able.