MefXapModuleTypeLoader in DROP 10

Topics: Prism v4 - Silverlight 4
Oct 17, 2010 at 1:34 PM

Hi all,

I just changed to drop 10  from drop 9 and Import is not worked properly for dynamically downloaded dll.  I traced and found  changed code in HandleDownloadCompleted as following;

before drop 9 :


drop 10 :

       foreach (ModuleInfo moduleInfo in moduleInfos)
               this.downloadedPartCatalogs.Add(moduleInfo, deploymentCatalog);

Is there any thread or blog I can look into what's in the behind story ?

Thank you in advance.





Oct 18, 2010 at 9:23 PM
Edited Oct 18, 2010 at 9:27 PM

Hi HK.Lee,

I do not know the exact error in your application, but if you are receiving a ChangedRejectedException, when using MEF you must mark the Microsoft.Practices.Prism.MefExtensions.dll with Copy Local = False in your modules. It avoids duplicate imports.

For more information on this topic you could take a look at the following documentation section in the Prism4.chm: Chapter 4: Modular Application Development, see the Preparing a Module for remote download using MEF section.

Additionally, you could check this configuration in the Modularity Quickstart with MEF.

If your problem is not related with this, could you please share a repro sample?

Hope this helps.

Fernando Antivero

Oct 23, 2010 at 4:14 PM

Hi Fernando,

Thank you for your reply and sorry for being my lazyness, bcz I still use drop 9 for current project.

"Copy Local = False" already set and it works without problem in drop 9.0.

The difference is drop 9 uses AggregateCatalog and adds deploymentCatalog after xap downloading completed as such;


however, drop 10 add downloadcatalog into it's own colelction without adding into AggegateCatalog  as such;

 foreach (ModuleInfo moduleInfo in moduleInfos)
                        this.downloadedPartCatalogs.Add(moduleInfo, deploymentCatalog);

so all Parts of downloaded xap can't be seen in AggregateCatalog, though existing in deplocatalog.

Should I take additional acton to add deploymentCatalog to AggregateCatalog ?



Oct 23, 2010 at 7:12 PM

Thanks for posting the issue and the details.  I will ensure someone from the team (probably myself of Larry) looks into this early this week.


Oct 25, 2010 at 10:11 PM

We changed this due to a bug that was discovered: if you have two (or more) modules in a XAP, you only get notified when one of them is loaded.
To fix this bug, we moved the responsibility (and the code) for registering the types discovered in a xap with the AggregateCatalog from the MefXapModuleTypeLoader's HandleDownloadCompleted method to the MefModuleInitializer's CreateModule method.  If you look at the CreateModule method, you will see the registration with the AggregateCatalog. This change also fixed a few timing issues that come up in rare cases with downloads and cross xap dependencies and a few other edge cases.

Do you have a small repro case we can look at to help track this down?

Michael Puleio

Nov 2, 2010 at 4:54 PM

Hi Michael,

Thank you for your kind reply and sorry for my late reply,due to customer demonstration I had to stick to drop 9.

I just changed to drop 10 and read line by line and find what I missed.

As you mentioned CreateModule method of MefModuleInitializer was changed  that was the problem,bcz I wrongly used assembly name instead of module name.

Thank you again for your kind attention.