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

  • Home
  • SEARCH
  • 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 7999005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:22:30+00:00 2026-06-04T15:22:30+00:00

I have one module with interface IModuleMainService with one event. e.g. [Export(typeof(IModuleMainService))] I have

  • 0

I have one module with interface IModuleMainService with one event.

e.g. [Export(typeof(IModuleMainService))]

I have SHELL with interface IMainService.

e.g. [Export(typeof(IMainService))]

In ModuleMain I have import [Import(typeof(IMainService)]

In this case application working, but I want to communicate with module and shell.

I try to insert importing to Shell.cs e.g.

[Import]
public IModuleMainService ModuleMainService { get; set; }

But I run application and I get error, see bellow. If I comment [Import] public IModuleMainService... application running succesfull.
Where is a problem?

The Point is: Consum event of Module class in SHELL.

System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition ‘Main.Silverlight.Views.Shell’ has been rejected. 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 == “Main.ViewModels.ShellViewModel”) AndAlso (exportDefinition.Metadata.ContainsKey(“ExportTypeIdentity”) AndAlso “Main.ViewModels.ShellViewModel”.Equals(exportDefinition.Metadata.get_Item(“ExportTypeIdentity”))))’, invalid exports may have been rejected.

Resulting in: Cannot set import ‘Main.Silverlight.Views.Shell.ViewModel (ContractName=”Main.ViewModels.ShellViewModel”)’ on part ‘Main.Silverlight.Views.Shell’.
Element: Main.Silverlight.Views.Shell.ViewModel (ContractName=”Main.ViewModels.ShellViewModel”) –> Main.Silverlight.Views.Shell –> AssemblyCatalog (Assembly=”Main, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”)

A first chance exception of type ‘System.ComponentModel.Composition.ImportCardinalityMismatchException’ occurred in System.ComponentModel.Composition

  • 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-06-04T15:22:32+00:00Added an answer on June 4, 2026 at 3:22 pm

    In prism programming the modules and the shell shall be seperated. No direct reference shall be declared from one module to another or to shell. What you need to do is to employ EventAggregator in order to exchange messages between either modules or shell.

    An alternative of using IEventAggregator is to use RegionScopes to pass messages.

    As as summary, do not create direct references between modules and shell; use IEventAggregator to exchange messages and declare your message carrying events in a common library which is reused by all of the modules and the shell.

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

Sidebar

Related Questions

I have developed a web application using Spring 3.1 In one of the module
I have this task of designing a new interface for a distributed application (multiple
I have the following setup in one module: class A(object): # stuff class B(object):
i have to get static information from one 'module' to another. I'm trying to
Scenario 1: I have one wrapper Perl script which uses another Perl module and
I have 2 perl modules every module use the second one i.e Module1.pm use
I have a module which supports creation of geographic objects using a company-standard interface.
I have troubles using the java ServiceLoader in a NetBeans module application. Here is
I have a module that uses std::string as part of its interface. I would
I'm using Delphi 2007 and I have this case: { CommonUnit.pas } type //

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.