{"record":{"id":"e28ea65d3bab42a1","repo":"PrismLibrary/Prism","slug":"resources-dependencyonmissingmodule-formatted-with","errorCode":null,"errorMessage":"Resources.DependencyOnMissingModule (formatted with moduleNames)","messagePattern":"Resources\\.DependencyOnMissingModule \\(formatted with moduleNames\\)","errorType":"exception","errorClass":"ModularityException","httpStatus":null,"severity":"error","filePath":"src/Prism.Core/Modularity/ModuleDependencySolver.cs","lineNumber":93,"sourceCode":"        /// when a cycle is found in the defined dependency graph.</exception>\n        public string[] Solve()\n        {\n            List<string> skip = new List<string>();\n            while (skip.Count < dependencyMatrix.Count)\n            {\n                List<string> leaves = this.FindLeaves(skip);\n                if (leaves.Count == 0 && skip.Count < dependencyMatrix.Count)\n                {\n                    throw new CyclicDependencyFoundException(Resources.CyclicDependencyFound);\n                }\n                skip.AddRange(leaves);\n            }\n            skip.Reverse();\n\n            if (skip.Count > knownModules.Count)\n            {\n                string moduleNames = this.FindMissingModules(skip);\n                throw new ModularityException(moduleNames, string.Format(CultureInfo.CurrentCulture,\n                                                            Resources.DependencyOnMissingModule,\n                                                            moduleNames));\n            }\n\n            return skip.ToArray();\n        }\n\n        private string FindMissingModules(List<string> skip)\n        {\n            string missingModules = \"\";\n\n            foreach (string module in skip)\n            {\n                if (!knownModules.Contains(module))\n                {\n                    missingModules += \", \";\n                    missingModules += module;\n                }","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Prism.Core/Modularity/ModuleDependencySolver.cs#L75-L111","documentation":"This ModularityException is thrown by ModuleDependencySolver.Solve when a module in the graph depends on a module that was never registered with AddModule. The message lists the missing module names, produced by FindMissingModules.","triggerScenarios":"Calling AddDependency(\"A\", \"B\") where \"B\" is not in knownModules — e.g. a module in config lists a dependency on a module not present in the catalog; case mismatch between the two name usages.","commonSituations":"Removing a module from the catalog while other modules still declare a dependency on it; renaming a module but forgetting to update consumers' DependsOn attributes; loading a partial module set in tests.","solutions":["Add the missing module to the catalog/solver with AddModule before solving","Remove the stale dependency from the depending module's declaration","Check the exception message (it contains the missing names) and align the spellings exactly"],"exampleFix":"// before\n// ModuleInfo for \"CoreModule\" missing from catalog, but:\n[Module(ModuleName=\"FeatureA\", DependsOn=new[]{\"CoreModule\"})]\n// after\n// ensure CoreModule's ModuleInfo is added to the ModuleCatalog","handlingStrategy":"try-catch","validationCode":"var missing = deps.Keys\n    .SelectMany(k => deps[k])\n    .Where(dep => !knownModules.Contains(dep))\n    .ToList();\nif (missing.Count > 0)\n    throw new InvalidOperationException($\"Missing modules: {string.Join(\",\", missing)}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var order = solver.Solve();\n}\ncatch (ModularityException ex)\n{\n    logger.LogError(ex, \"Modules depend on missing modules: {0}\", ex.Message);\n}","preventionTips":["Keep ModuleCatalog entries and DependsOn declarations in sync","Run Solve in integration tests before shipping","Use module-name constants shared between declarations and consumers"],"tags":["missing-module","modularity","modulecatalog","prism"],"backgroundTag":"missing-dependency","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}