{"record":{"id":"fdf1ebd143a52577","repo":"PrismLibrary/Prism","slug":"raiseerrorschanged","errorCode":null,"errorMessage":"raiseErrorsChanged","messagePattern":"raiseErrorsChanged","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Prism.Core/Mvvm/ErrorsContainer.cs","lineNumber":32,"sourceCode":"        /// <summary>\n        /// Delegate to be called when raiseErrorsChanged is invoked.\n        /// </summary>\n        protected readonly Action<string> raiseErrorsChanged;\n\n        /// <summary>\n        /// A map from property name to a <see cref=\"List{T}\"/> of the errors and sources.\n        /// </summary>\n        protected readonly Dictionary<string, List<T>> validationResults;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ErrorsContainer{T}\"/> class.\n        /// </summary>\n        /// <param name=\"raiseErrorsChanged\">The action that is invoked when errors are added for an object.</param>\n        public ErrorsContainer(Action<string> raiseErrorsChanged)\n        {\n            if (raiseErrorsChanged == null)\n            {\n                throw new ArgumentNullException(nameof(raiseErrorsChanged));\n            }\n\n            this.raiseErrorsChanged = raiseErrorsChanged;\n            this.validationResults = new Dictionary<string, List<T>>();\n        }\n\n        /// <summary>\n        /// Gets a value indicating whether the object has validation errors. \n        /// </summary>\n        public bool HasErrors\n        {\n            get\n            {\n                return this.validationResults.Count != 0;\n            }\n        }\n\n        /// <summary>","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Prism.Core/Mvvm/ErrorsContainer.cs#L14-L50","documentation":"The ErrorsContainer<T> constructor throws ArgumentNullException when the 'raiseErrorsChanged' delegate is null. This delegate is how the container notifies INotifyDataErrorInfo consumers that errors changed, so it is mandatory.","triggerScenarios":"Constructing new ErrorsContainer<T>(null) inside a BindableBase-derived class instead of passing an action like RaiseErrorsChanged; forgetting to wire the errors-changed callback.","commonSituations":"Refactoring ViewModel base classes and dropping the delegate argument; copying the ErrorsContainer pattern from documentation incompletely.","solutions":["Pass a method group such as RaiseErrorsChanged that implements the notification","Ensure the containing class implements INotifyDataErrorInfo and has a ErrorsChanged event to raise","Use nameof-based wiring: new ErrorsContainer<string>(RaiseErrorsChanged)"],"exampleFix":"// before\nErrorsContainer = new ErrorsContainer<string>(null);\n// after\nErrorsContainer = new ErrorsContainer<string>(RaiseErrorsChanged);","handlingStrategy":"validation","validationCode":"Action<string> handler = RaiseErrorsChanged;\nif (handler == null)\n    throw new InvalidOperationException(\"ErrorsChanged handler must be wired before creating ErrorsContainer\");","typeGuard":null,"tryCatchPattern":"try\n{\n    _errorsContainer = new ErrorsContainer<string>(RaiseErrorsChanged);\n}\ncatch (ArgumentNullException ex)\n{\n    logger.LogError(ex, \"raiseErrorsChanged delegate was null\");\n}","preventionTips":["Follow the BindableBase pattern: wire RaiseErrorsChanged in the ViewModel base class","Never construct ErrorsContainer with a literal null","Keep INotifyDataErrorInfo boilerplate in one shared base class"],"tags":["argumentnullexception","validation","mvvm","prism"],"backgroundTag":"null-argument","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"}