I am writing a tool which communicates with more than one version control system, either subversion or clearcase, and has various utilities which can be plugged into it. I though of using MEF to load the version control providers, and utiilities, both of which have interfaces definied for them.
I've started to use MEF for this. But if loading any plugin fails (on half my clients machines, the ClearCase COM bindings won't be present, so loading will fail, on the other half SVN won't be installed, so the SVN plugin won't load) though, MEF throws an exception and no plugin works; I was hoping that the rest of the plugins would load.
[ImportMany(AllowRecomposition = true)]
public IEnumerable<IVersionControl> RegisteredProviders { get; private set; }
Instead, if any providers fail to construct themselves, then RegisteredProviders is null.
Is there a simple way of configuring MEF to achieve this (reporting exceptions but loading other instances), or do I have to change the interface to delay their intialisation failure until after MEF has instantiated the objects?