I have the problem that I want to import types from a module dictionary. But because of the plugin based modularity some imports may fail.
But if only one import fails, nothing gets imported - which is certainly not wanted.
try
{
// Use the binary directory
var catalog = new DirectoryCatalog(AssemblyDirectory);
var container = new CompositionContainer(catalog);
// Build the composition batch
var compositionBatch = new CompositionBatch();
compositionBatch.AddPart(this); // for discovering modules
// Compose everything
container.Compose(compositionBatch);
}
catch (ReflectionTypeLoadException loadException)
{
// Nothing will be done here
}
The correct and wanted behavior would be, that all matching types shall be imported, but the failing gets ignored.
How can I accomplish that? Thanks in advance