PrismLibrary/Prism · critical · PrismInitializationException
An error was encountered while configuring the Module…
Error message
An error was encountered while configuring the Module Catalog
What it means
During app initialization Prism runs all IModuleCatalog configuration delegates and collects exceptions. If exactly one module catalog error occurs, it is rethrown as a PrismInitializationException with this message. It signals that module discovery/registration failed at startup.
Solutions
- Inspect InnerException of the PrismInitializationException for the module that failed.
- Verify the failing module's assembly is included in the app and the module type is public with a valid constructor.
- Fix or remove the AddModule/ConfigureModuleCatalog registration for the broken module.
- If multiple modules fail you would instead see an AggregateException; isolate by disabling modules one at a time.
Example fix
// before moduleCatalog.AddModule<BillingModule>(); // assembly not referenced // after: ensure the project references the Billing module assembly, then moduleCatalog.AddModule<BillingModule>(InitializationMode.WhenAvailable);
Defensive patterns
Strategy: validation
Validate before calling
// Validate module types are loadable before registering
var t = typeof(BillingModule);
if (t.IsClass && !t.IsAbstract && Assembly.GetAssembly(t) != null)
moduleCatalog.AddModule(t); Try / catch
try
{
await host.StartAsync();
}
catch (PrismInitializationException ex)
{
logger.LogError(ex.InnerException, "Module catalog configuration failed");
} Prevention
- Reference all module assemblies in the head app project.
- Keep module types public with parameterless-friendly constructors.
- Run a CI build that loads the full module catalog before release.
When it happens
Trigger: Calling UsePrism with OnInitialized/ConfigureModuleCatalog code that throws for a single module — e.g. AddModule for an assembly or type that cannot be loaded, or a module's RegisterTypes throwing during catalog configuration.
Common situations: Referencing a module assembly missing from the app package; a module type renamed/moved after refactor; single module failing to initialize its catalog entries on MAUI startup.
Related errors
- One or more errors were encountered while configuring the…
- An error occurred while initializing the Modules.
- An error was encountered while invoking the OnInitialized…
- One or more errors were encountered while executing the…
- You must call CreateWindow on the PrismAppBuilder.
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/77e723c5203b6a1d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/PrismAppBuilder.cs:208
var errors = new List<Exception>();
// Phase 1: Configure the module catalog
_moduleCatalogActions.ForEach(action =>
{
try
{
action(_container);
}
catch (Exception ex)
{
logger.LogError(ex, "Error executing Module Catalog Configuration Delegate.");
errors.Add(ex);
}
});
if (errors.Count == 1)
{
throw new PrismInitializationException("An error was encountered while configuring the Module Catalog", errors[0]);
}
else if (errors.Count > 1)
{
throw new AggregateException("One or more errors were encountered while configuring the Module Catalog", [.. errors]);
}
// Phase 2: Initialize modules so their services are registered
if (_container.IsRegistered<IModuleCatalog>() && _container.Resolve<IModuleCatalog>().Modules.Any())
{
try
{
logger.LogDebug("Initializing modules.");
var manager = _container.Resolve<IModuleManager>();
manager.Run();
logger.LogDebug("Modules Initialized.");
}
catch (Exception ex)
{View on GitHub (pinned to 358118cd64)