{"record":{"id":"537d3a20c94580ee","repo":"PrismLibrary/Prism","slug":"resources-configurationstorecannotbenull","errorCode":null,"errorMessage":"Resources.ConfigurationStoreCannotBeNull","messagePattern":"Resources\\.ConfigurationStoreCannotBeNull","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Wpf/Prism.Wpf/Modularity/ConfigurationModuleCatalog.Desktop.cs","lineNumber":32,"sourceCode":"        /// </summary>\n        public ConfigurationModuleCatalog()\n        {\n            Store = new ConfigurationStore();\n        }\n\n        /// <summary>\n        /// Gets or sets the store where the configuration is kept.\n        /// </summary>\n        public IConfigurationStore Store { get; set; }\n\n        /// <summary>\n        /// Loads the catalog from the configuration.\n        /// </summary>\n        protected override void InnerLoad()\n        {\n            if (Store == null)\n            {\n                throw new InvalidOperationException(Resources.ConfigurationStoreCannotBeNull);\n            }\n\n            EnsureModulesDiscovered();\n        }\n\n        private void EnsureModulesDiscovered()\n        {\n            ModulesConfigurationSection section = Store.RetrieveModuleConfigurationSection();\n\n            if (section != null)\n            {\n                foreach (ModuleConfigurationElement element in section.Modules)\n                {\n                    IList<string> dependencies = new List<string>();\n\n                    if (element.Dependencies.Count > 0)\n                    {\n                        foreach (ModuleDependencyConfigurationElement dependency in element.Dependencies)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Wpf/Prism.Wpf/Modularity/ConfigurationModuleCatalog.Desktop.cs#L14-L50","documentation":"ConfigurationModuleCatalog.InnerLoad throws InvalidOperationException when the Store property (the IConfigurationStore used to read module configuration) is null. The catalog loads modules from a configuration section, so without a store it cannot proceed. Prism throws early with a clear message instead of a NullReferenceException later.","triggerScenarios":"Instantiating ConfigurationModuleCatalog and calling Load() (e.g. via CreateFromConfigurationState) without first assigning a ConfigurationStore, such as when the catalog is created by the container without configuring it.","commonSituations":"Forgetting to register/set ConfigurationStore when wiring the module catalog manually; using ConfigurationModuleCatalog in tests without a stub store; container registration missing so Store stays null.","solutions":["Set the Store property to a ConfigurationStore instance before calling Load: catalog.Store = new ConfigurationStore();","Register IConfigurationStore/ConfigurationStore in your DI container so the catalog is constructed with it.","Prefer the standard bootstrapper/PrismApplication setup that configures the store automatically via CreateFromConfigurationState.","In tests, assign a fake IConfigurationStore that returns your test module section."],"exampleFix":"// before\nvar catalog = new ConfigurationModuleCatalog();\ncatalog.Load();\n\n// after\nvar catalog = new ConfigurationModuleCatalog { Store = new ConfigurationStore() };\ncatalog.Load();","handlingStrategy":"validation","validationCode":"if (catalog is ConfigurationModuleCatalog cmc && cmc.Store == null)\n    throw new InvalidOperationException(\"ConfigurationModuleCatalog.Store must be set before Load().\");","typeGuard":"static bool HasStore(ConfigurationModuleCatalog c) => c.Store != null;","tryCatchPattern":"try { catalog.Load(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"ConfigurationStore\")) { logger.LogError(ex, \"Module catalog configuration store missing\"); }","preventionTips":["Assign Store immediately after constructing the catalog.","Register ConfigurationStore in the DI container.","Prefer standard bootstrapper/PrismApplication setup paths.","Cover catalog construction in unit tests."],"tags":["configuration","null","modularity","wpf"],"backgroundTag":"missing-required-config","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}