Recomposition error while removing deployment catalog

Topics: Prism v4 - Silverlight 4
Dec 13, 2010 at 3:06 PM

Hi,

In my application I load external xap's onto my application using DeploymentCatalog. I do this by creating a DeploymentCatalog and add it to the AggregateCatalog. The xap's get downloaded and everything is fine.

My application allows the user to close the container where the external xap gets downloaded. On closing I want to remove the DeploymentCatalog frm the AggregateCatalog. But the moment I call AggregateCatalog.Remove(DeploymentCatalog) it tries to recompose all the exports in it. I don't understand why it tries to recompose while removing the catalog. I'm having to do inline instantiations of the view models in the xap to get around this.

Is this a desired behavior or is it a bug?

Developer
Dec 13, 2010 at 6:58 PM
Edited Dec 14, 2010 at 2:00 PM

Hi,

You could try setting the imports with with AllowRecomposition=true. You could read more about DeploymentCatalogs in this article from the MEF Codeplex Project.

As this is mainly related to a MEF feature, you might find better support in the MEF forum.

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Dec 14, 2010 at 6:11 AM

Hi,

I have already tried setting AllowRecomposition=true. But that doesnt help at all. I have posted in continuation to a forum post in the MEF forums here. Havent got a reply as yet. So I started this discussion here as MEF is integrated now with Prism 4.

Developer
Dec 14, 2010 at 2:00 PM

Hi,

There doesn't seem to be anything in Prism that could cause that behavior in MEF.

You could also try posting your question in the MSDN MEF forum, as you might get a faster response there.

In the meantime, you might find the following resources useful:

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Dec 15, 2010 at 6:21 AM

Thanks Guido.

I have posted in the MEF forum about this but havent got any response. Also I dont understand why should I use ImportMany when I'm expecting just one instance of it? Also if I use ImportMany i'll have to have a collection of my import type, which I dont want.

Developer
Dec 16, 2010 at 4:23 PM
Edited Dec 16, 2010 at 4:35 PM

Hi,

Aside from the MEF Codeplex forum where you've posted your question, there is another forum for the Managed Extensibility Framework in MSDN, which you can access here.

As for the thread regarding ImportMany, I did not intend to suggest using ImportMany in your scenario. I pointed you to that thread because it might provide you with some insight about the undesidred recomposition of imports in MEF.

I hope this clarifies the doubts my previous response may have risen.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Dec 28, 2010 at 3:30 AM

Hi Guido,

Unfortunately no one has responded to my post in the MEF forum in MSDN. Is there anyway you could help?

Dec 28, 2010 at 5:46 AM

Apparently I found the solution to this problem and have posted the solution in the MEF MSDN forum.

Developer
Dec 28, 2010 at 1:22 PM

Ganesh,

I'm glad that you've found a solution to your recomposition issue. Thank you for posting it here for the community.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi