I'm currently using MEF and a DirectoryCatalog to load some parts from some extension DLLs. It works for me, and most of the people that use the program, but some users experience the parts not being loaded at all. Collecting some debug information, it seems that MEF does load the DLLs (catalog.LoadedFiles lists them), but that no parts are listed in catalog.Parts.
One user is on XP sp3 and one is on Windows 7, so I don't think that the OS is the problem. Does anyone have some idea of why this would be happening?
The following is the code that actually creates the container, in case it would help with anything.
private static IEnumerable<Task> CreateTypes()
{
CompositionContainer container = GetContainer();
var exp = container.GetExports<Task>();
return exp.Select(e => e.Value);
}
private static CompositionContainer container;
public static CompositionContainer GetContainer()
{
if (container != null)
return container;
DirectoryCatalog catalog = new DirectoryCatalog(ExtensionDirectory, "*.dll");
container = new CompositionContainer(catalog);
return container;
}
C:\Program Files
.. maybe an issue? – Bridging