PrismLibrary/Prism · critical · AggregateException

One or more errors were encountered while configuring the…

Error message

One or more errors were encountered while configuring the Module Catalog

What it means

If more than one exception is collected while configuring the Module Catalog during Prism initialization, Prism aggregates them and throws an AggregateException with this message. It means multiple modules failed their catalog configuration in the same startup pass.

Solutions

  1. Enumerate the InnerExceptions of the AggregateException to list every failing module.
  2. Fix each module's registration/assembly reference; fix the shared root cause if all fail for the same reason (e.g. missing shared dependency).
  3. Temporarily register modules one at a time to bisect which ones are broken.
  4. Ensure all module assemblies ship in the app package and types are public.

Example fix

// before: two broken registrations
moduleCatalog.AddModule<BillingModule>();
moduleCatalog.AddModule<ReportingModule>();
// after: verify both assemblies referenced and types exist, or remove the ones not shipped
moduleCatalog.AddModule<BillingModule>();
Defensive patterns

Strategy: validation

Validate before calling

var failing = modules.Where(m => Assembly.Load(m.AssemblyName) == null).ToList();
if (failing.Any()) throw new InvalidOperationException($"Missing assemblies: {string.Join(",", failing)}");

Try / catch

try
{
    OnInitialized();
}
catch (AggregateException ex)
{
    foreach (var inner in ex.InnerExceptions)
        logger.LogError(inner, "Module catalog error");
}

Prevention

When it happens

Trigger: Two or more AddModule registrations (or module catalog configuration delegates) throwing during OnInitialized — e.g. multiple module assemblies that fail to load or multiple modules whose catalog setup throws.

Common situations: App-wide startup breakage after a rename/refactor touching several modules; missing several module assemblies in the deployment; container registration failures across multiple modules.

Related errors


AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15). Data as JSON: /api/errors/1fdb3afa03f8f9a1. Report an issue: GitHub.

Appendix: source

Thrown at src/Maui/Prism.Maui/PrismAppBuilder.cs:212

        {
            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)
            {
                logger.LogError(ex, "An error ocurred while initializing the Modules.");
                throw new PrismInitializationException("An error occurred while initializing the Modules.", ex);
            }
        }

View on GitHub (pinned to 358118cd64)