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 IPlugInInterface. 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(string dir, AppDomain domain)
{
ArrayList ar = new ArrayList();
foreach (string File in System.IO.Directory.GetFiles(dir, "*.dll"))
{
try
{
Type ct = typeof(TestNamespace.PlugIn.IPlugInInterface);
System.Reflection.Assembly asm =
System.Reflection.Assembly.LoadFrom(File);
foreach (Type t in asm.GetTypes())
{
foreach (Type iface in t.GetInterfaces())
{
//*******************************
// see text below
//*******************************
if (ct.IsAssignableFrom(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
IsAssignableFrom always returns false.
Any ideas
TIA
Joe