title: Can't load multiple MEF parts
body: <p>I have a Winforms desktop application that is loading multiple MEF parts with the same Interface type.</p>
  
  <p>Problem:
  When I try to load more than one of the same type I get the following exception:</p>
  
  <p>The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.</p>
  
  <p>1) No valid exports were found that match the constraint '((exportDefinition.ContractName = "BOCA.TaskPilot.Common.Extensions.IFolderViewExtension") &amp;&amp; (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") &amp;&amp; "BOCA.TaskPilot.Common.Extensions.IFolderViewExtension".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.</p>
  
  <p>Resulting in: Cannot set import 'TaskPilot.Windows.MainForm.FolderViewExtension (ContractName="BOCA.TaskPilot.Common.Extensions.IFolderViewExtension")' on part 'TaskPilot.Windows.MainForm'.
  Element: TaskPilot.Windows.MainForm.FolderViewExtension (ContractName="BOCA.TaskPilot.Common.Extensions.IFolderViewExtension") -->  TaskPilot.Windows.MainForm</p>
  
  <p>Here is the code to load the parts:</p>
  
  <pre><code>            AggregateCatalog catalog = new AggregateCatalog();
          catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
          //string myExecName = Assembly.GetExecutingAssembly().Location;
          //string myPath = Path.GetDirectoryName(myExecName);
          catalog.Catalogs.Add(new DirectoryCatalog(@"C:\Data\TaskPilot\Development\Source\BOCA.TaskPilot.FolderView\bin\Debug"));
          catalog.Catalogs.Add(new DirectoryCatalog(@"C:\Data\TaskPilot\Development\Source\BOCA.TaskPilot.TaskView\bin\Debug"));
          // Uncomment below line and it works without exceptions raised
          //catalog.Catalogs.Add(new DirectoryCatalog(@"C:\Data\TaskPilot\Development\Source\BOCA.FileManager\bin\Debug"));
  
          var container = new CompositionContainer(catalog);
          container.ComposeParts(this);
  </code></pre>
  
  <p>Here's the code at the class for each of the MEF parts:</p>
  
  <pre><code>[Export(typeof(IFolderItemsViewExtension))
  public partial class TaskTreeView : DevExpress.XtraEditors.XtraUserControl, IFolderItemsViewExtension, IPartImportsSatisfiedNotification]
  </code></pre>
  
  <p>Here's the Import used on the Main form:</p>
  
  <pre><code>[ImportMany(AllowRecomposition = true)]
      private IEnumerable&lt;IFolderItemsViewExtension&gt; TaskViewExtensions = null;
  </code></pre>
  
  <p>If I uncomment the last Catalog.Catalogs.Add line it throws the exception. If I run it without that it runs just fine. That line loads a different user control that implements the IFolderItemsViewExtension Interface. I've tried to just load a dummy project that all it has is the user control and that interface and I still get the same exception. No matter what I do I still get this exception.</p>
  
  <p>It seems that everything runs fine as long as I'm not loading more than one of the same type of MEF part export.</p>
  
  <p>This is using the latest version of 2009.22.10.0 of the System.ComponentModel.Composistion from the MEF download.</p>