Based on my understanding this error is thrown because one of the validation used by the default implementation of the
ModuleCatalog provided by Prism.
As explained in the comments of the ModuleCatalog class, this implementation among other things verifies that there are no Invalid dependencies, such as a Module that's loaded at start up that depends on a module that might need to be retrieved.
In my opinion the team considered that all modules loaded at start up might have all its dependencies loaded as well (on start-up).
Therefore to avoid this error, as the message explains you could change your module dependency ("ParentModule") to
InitializationMode="WhenAvailable". Or as mentioned remove the aforementioned validation by extending the
As explained in
Appendix E: Extending Prism,Adding Features to the Module Catalog:
There are several ways to extend the functionality of the ModuleCatalog:
- Derive from ModuleCatalog. If you need to change the behavior of
ModuleCatalog, derive a new class and override one of the virtual methods.
- Write extension methods on IModuleCatalog. If you need additional functionality in your application where you use
IModuleCatalog, write an extension method on the interface.
- Write extension methods on ModuleCatalog. If you need additional functionality, but only in places where you use
ModuleCatalog, write an extension method on the concrete type.
Hence, I believe you could created a CustomModuleCatalog class according to the requirements of your scenario. In which, you could derive from the default
ModuleCatalog class, and for example override the Validate() method of this class, changing how you want the validation to be done, for example like in the following code snippet:
public override void Validate()
//I Commented this line as an example to remove the aforementioned validation
this.Validated = true;
Then, once you have your CustomModuleCatalog you can override the CreateModuleCatalog
method in your bootstrapper in order to create your own module catalog class,for example like this:
protected override IModuleCatalog CreateModuleCatalog()
return CustomModuleCatalog.CreateFromXaml(new Uri("/Prism.Workshop.Shell;component/ModulesCatalog.xaml", UriKind.Relative));
I hope you find this handy,