PrismLibrary/Prism · error · ModularityException

Resources.ModuleDependenciesNotMetInGroup (formatted with…

Error message

Resources.ModuleDependenciesNotMetInGroup (formatted with moduleInfo.ModuleName)

What it means

ValidateDependencies throws ModularityException with Resources.ModuleDependenciesNotMetInGroup when a module depends on another module that is not present in the same dependency group. Prism requires all intra-group dependencies to be resolvable within the group so the group can load as a unit.

Solutions

  1. Correct the DependsOn entry to match the exact ModuleName of a module in the same group.
  2. Add the missing dependency module to the same dependency group.
  3. Remove the stale dependency if the depended-on module no longer exists.
  4. Search configs/XAML for the reported module name to find the mismatched reference.

Example fix

// before (module 'A' in group 1 depends on 'B' which is outside the group)
new ModuleInfo { ModuleName = "A", DependsOn = new[] { "B" }, Group = "Group1" }
// after
new ModuleInfo { ModuleName = "A", DependsOn = new[] { "B" }, Group = "Group1" },
new ModuleInfo { ModuleName = "B", Group = "Group1" }
Defensive patterns

Strategy: validation

Validate before calling

var names = groupModules.Select(m => m.ModuleName).ToHashSet();
foreach (var m in groupModules)
{
    var missing = (m.DependsOn ?? Enumerable.Empty<string>()).Where(d => !names.Contains(d)).ToList();
    if (missing.Any())
        throw new InvalidOperationException($"{m.ModuleName} depends on missing group members: {string.Join(",", missing)}");
}

Try / catch

try
{
    catalog.Validate();
}
catch (ModularityException ex)
{
    logger.LogError(ex, "Intra-group dependency not met: {0}", ex.Message);
    // fix the DependsOn entry or move the dependency into the same group
}

Prevention

When it happens

Trigger: A module in a dependency group lists a ModuleName in its DependsOn collection that does not exist among the group's modules; detected when the catalog is validated (Validate/EnsureCatalogValidated) before loading.

Common situations: Typo in a DependsOn entry; a module was moved out of a group (or removed) while others still depend on it; XAML/config group definitions out of sync with module names after a rename.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at src/Prism.Core/Modularity/ModuleCatalogBase.cs:243

        /// within that list.
        /// </summary>
        /// <param name="modules">The modules to validate modules for.</param>
        /// <exception cref="ModularityException">
        /// Throws if a <see cref="IModuleInfo"/> in <paramref name="modules"/> depends on a module that's
        /// not in <paramref name="modules"/>.
        /// </exception>
        /// <exception cref="ArgumentNullException">Throws if <paramref name="modules"/> is <see langword="null"/>.</exception>
        protected static void ValidateDependencies(IEnumerable<IModuleInfo> modules)
        {
            if (modules == null)
                throw new ArgumentNullException(nameof(modules));

            var moduleNames = modules.Select(m => m.ModuleName).ToList();
            foreach (var moduleInfo in modules)
            {
                if (moduleInfo.DependsOn != null && moduleInfo.DependsOn.Except(moduleNames).Any())
                {
                    throw new ModularityException(
                        moduleInfo.ModuleName,
                        string.Format(CultureInfo.CurrentCulture, Resources.ModuleDependenciesNotMetInGroup, moduleInfo.ModuleName));
                }
            }
        }

        /// <summary>
        /// Does the actual work of loading the catalog.  The base implementation does nothing.
        /// </summary>
        protected virtual void InnerLoad()
        {
        }

        /// <summary>
        /// Sorts a list of <see cref="IModuleInfo"/>s. This method is called by <see cref="CompleteListWithDependencies"/>
        /// to return a sorted list.
        /// </summary>
        /// <param name="modules">The <see cref="IModuleInfo"/>s to sort.</param>

View on GitHub (pinned to 358118cd64)