This project has moved. For the latest updates, please go here.

InvalidOperation (MEF) - dynamic download -regionManagementDynamic

Feb 3, 2011 at 5:14 PM
Edited Feb 3, 2011 at 5:14 PM

One of the really great things about Jounce is it's ability to dynamically download applications.  The RegionManagement and RegionManagementDynamic samples are excellent and were a great way to learn. 

I attempted adding a new SL application to the solution, removing the App file, and applying the ExportAsView and ExportViewToRegion attributes to the MainPage.xaml.cs file. 

The .xap for the application winds up in the clientBin of the hosting web app as it should when compiled.

I added an [Export] to a new ViewXapRoute property that is defined in the same class as the one for the dynamice ViewXapRoute is defined.

So the .xap is properly downloaded when requested to be displayed on the UI, however, MEF blows up due to some recomposition issue.  I've pasted the beginning of the trace, but there are actually 26 messages in all associated with the exception below.

As far as I can tell, my new application is setup EXACTLY as the RegionManagementDynamic project, and the attributes are applied and referenced as they should be.  I'm not a MEF expert, I know enough to be dangerous.  Any thoughts?  Thanks!

 

System.InvalidOperationException: The package downloaded successfully but an error occurred while reading the contents of the package. See the inner exception for more details. ---> System.ComponentModel.Composition.ChangeRejectedException: The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced multiple composition errors, with 26 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.

 

1) Change in exports prevented by non-recomposable import 'Jounce.Framework.Services.ApplicationService.DeploymentService (ContractName="Jounce.Core.Application.IDeploymentService")' on part 'Jounce.Framework.Services.ApplicationService'.

2) Change in exports prevented by non-recomposable import 'Jounce.Framework.Services.ApplicationService.EventAggregator (ContractName="Jounce.Core.Event.IEventAggregator")' on part 'Jounce.Framework.Services.ApplicationService'.

 

 

 

Feb 3, 2011 at 5:54 PM

Nevermind, I found it.  Thanks Paul!

PaulLinton Oct 14 2010 at 6:21 PM 

In the dynamically loaded module make sure that the references to Jounce.* are set to be Copy Local = False. Failure to do so will give MEF errors
'Change in exports prevented by non-recomposable import'

Feb 4, 2011 at 10:52 AM

You should use Xaps Minifier (http://visualstudiogallery.msdn.microsoft.com/6052ef76-768d-4ec2-ac2c-8a7ef1c01272) for avoid those problems.