ModuleManager is there support redownloading modules?

Topics: Prism v4 - Silverlight 4
Jul 11, 2012 at 7:20 AM
Edited Apr 30, 2013 at 7:21 AM
In the current implementation of the ModuleManager, if a module fails to download, it is not possible to download it again. Is there a recommendation on how to allow for this (preferably without modifying Prism's source and rebuilding)?

The problem is in that the ModuleManager.downloadingModules holds onto the URIs of failed downloads, thus prevent new download requests for being created. (This downloadingModules dictionary is usually updated inside the RecordDownloadComplete method, which is called from the HandleModuleDownloaded callback). Ideally I think it would be nice if the downloadingModules dictionary is updated all the time (or at the very least, if the events error was handled)

(Edit, fixed several typos)
Jul 12, 2012 at 6:51 PM
Edited Jul 13, 2012 at 5:28 PM


Based on my understanding this scenario is not supported in Prism as out of the box. In order to achieve it, I believe you will have to implement your own module retrieval strategy.

In order to do this, you could modify or create your custom implementation of the XapModuleTypeLoader, for example by modifying the HandleModuleDownloaded method in this class, to remove the corresponding Uri from the downloadingModules dictionary if an error was received. Take into account that this implementation will depend mostly on your personal preferences and the requirements of your scenario.

As far as I know, you will have to modify this class from the Prism library, or as an alternative you could register a custom ModuleManager in your container, in order to return your custom implementation of the XapModuleTypeLoader instead of the default one.

Also, remember that if you don't want to receive the exception in your application, you will have to set the IsErrorHandled property value to true in the LoadModuleCompletedEventArgs.

Additionally, if you believe this behavior should be supported in Prism by default, I believe you could create a work item in the Issue tracker section, so that the Prism team can analyze it for future releases.


Agustin Adami