Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 549059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:08:41+00:00 2026-05-13T11:08:41+00:00

I have a Winforms desktop application that is loading multiple MEF parts with the

  • 0

I have a Winforms desktop application that is loading multiple MEF parts with the same Interface type.

Problem:
When I try to load more than one of the same type I get the following exception:

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.

1) No valid exports were found that match the constraint ‘((exportDefinition.ContractName = “BOCA.TaskPilot.Common.Extensions.IFolderViewExtension”) && (exportDefinition.Metadata.ContainsKey(“ExportTypeIdentity”) && “BOCA.TaskPilot.Common.Extensions.IFolderViewExtension”.Equals(exportDefinition.Metadata.get_Item(“ExportTypeIdentity”))))’, invalid exports may have been rejected.

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

Here is the code to load the parts:

            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);

Here’s the code at the class for each of the MEF parts:

[Export(typeof(IFolderItemsViewExtension))
public partial class TaskTreeView : DevExpress.XtraEditors.XtraUserControl, IFolderItemsViewExtension, IPartImportsSatisfiedNotification]

Here’s the Import used on the Main form:

[ImportMany(AllowRecomposition = true)]
    private IEnumerable<IFolderItemsViewExtension> TaskViewExtensions = null;

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.

It seems that everything runs fine as long as I’m not loading more than one of the same type of MEF part export.

This is using the latest version of 2009.22.10.0 of the System.ComponentModel.Composistion from the MEF download.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:08:42+00:00Added an answer on May 13, 2026 at 11:08 am

    The error indicates that it can’t find an export of type IFolderViewExtension. Note that this is different from the import of IFolderItemsViewExtension you have shown.

    My guess is that the problem is not that you have multiple IFolderItemsViewExtensions, but that you have multiple IFolderViewExtensions, or there is some other contract that you have more than one of that you are using with an import that requires exactly one.

    This may be caused because you have the same assembly in more than one of your directory catalogs. It is easy for this to happen if you have a reference to an assembly and copy local is set to true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a desktop(winforms) application, and I'm looking for .net linker that links the
I have a desktop (winforms) application that uses a Firebird database as a data
We currently have a number of desktop applications (PowerBuilder, Winforms, WPF) that make use
I have a desktop written with Winforms. Now I have requests that people want
I have a Winforms application (written in C#) that is deployed on a network
I have a winforms application and I am trying to create a method that
I have a winforms Application, On Close button click, I am hiding that application
We have a desktop application that has been using MapPoint for displaying data on
I'm using Microsoft's SplitContainer control in my WinForms desktop application. I'd like to have
I have a Winforms application that the user uses to take a region based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.