Hi all,
Using Windows CP Pro
VS .net 2005
I'm creating an app that allows user to extend its functionality by
installing plug in modules, these modules support an interface I have
created called IPlugInInterfac e. The problem is when I come to load them
I check each dll to see if supports this interface, they all return
false even though when I inspect them during debugging they look the
same, I use the following function:
public ArrayList SearchPath(stri ng dir, AppDomain domain)
{
ArrayList ar = new ArrayList();
foreach (string File in System.IO.Direc tory.GetFiles(d ir, "*.dll"))
{
try
{
Type ct = typeof(TestName space.PlugIn.IP lugInInterface) ;
System.Reflecti on.Assembly asm =
System.Reflecti on.Assembly.Loa dFrom(File);
foreach (Type t in asm.GetTypes())
{
foreach (Type iface in t.GetInterfaces ())
{
//*************** *************** *
// see text below
//*************** *************** *
if (ct.IsAssignabl eFrom(iface))
{
ar.Add(t);
break;
}
}
}
}
catch (Exception ex)
{
}
}
return ar;
}
//*************** ***
this is where the problem occurs, if I inspect both ct and iface both
seem to be of the same type, ie namespace and name etc but the call to
IsAssignableFro m always returns false.
Any ideas
TIA
Joe