{"record":{"id":"17acdd9aea4cac76","repo":"dotnet/wpf","slug":"argumentnullexception-nameof-value","errorCode":null,"errorMessage":"ArgumentNullException(nameof(value))","messagePattern":"ArgumentNullException\\(nameof\\(value\\)\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingListCollectionView.cs","lineNumber":1149,"sourceCode":"        public bool? IsLiveFiltering\n        {\n            get { return IsDataView ? (bool?)true : (bool?)null; }\n            set { throw new InvalidOperationException(SR.Format(SR.CannotChangeLiveShaping, \"IsLiveFiltering\", \"CanChangeLiveFiltering\")); }\n        }\n\n        ///<summary>\n        /// Gets or sets a value that indicates whether live grouping is enabled.\n        /// The value may be null if the view does not know whether live grouping is enabled.\n        /// Calling the setter when CanChangeLiveGrouping is false will throw an\n        /// InvalidOperationException.\n        ///</summary>\n        public bool? IsLiveGrouping\n        {\n            get { return _isLiveGrouping; }\n            set\n            {\n                if (value == null)\n                    throw new ArgumentNullException(nameof(value));\n\n\n                if (value != _isLiveGrouping)\n                {\n                    _isLiveGrouping = value;\n                    RefreshOrDefer();\n\n                    OnPropertyChanged(nameof(IsLiveGrouping));\n                }\n            }\n        }\n\n        ///<summary>\n        /// Gets a collection of strings describing the properties that\n        /// trigger a live-sorting recalculation.\n        /// The strings use the same format as SortDescription.PropertyName.\n        ///</summary>\n        ///<notes>","sourceCodeStart":1131,"sourceCodeEnd":1167,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingListCollectionView.cs#L1131-L1167","documentation":"The IsLiveGrouping setter on BindingListCollectionView requires a non-null bool?; passing null throws ArgumentNullException(nameof(value)). Unlike IsLiveSorting/IsLiveFiltering, this property is actually settable, but only with true or false.","triggerScenarios":"Assigning null explicitly (e.g. view.IsLiveGrouping = null;) or binding a nullable bool that evaluates to null to IsLiveGrouping. Also occurs when data-binding supplies a null value through a converter or missing value.","commonSituations":"Two-way bindings to IsLiveGrouping where the source property is a nullable bool that is unset; code that clears live grouping by assigning null instead of false.","solutions":["Assign true or false instead of null; use false to turn live grouping off.","Ensure the bound source property is a non-null bool (bool rather than bool?) or provide a DefaultValue/converter.","Add a null check or coalesce before assignment: view.IsLiveGrouping = flag ?? false;"],"exampleFix":"// before\nview.IsLiveGrouping = someNullableBool;\n\n// after\nview.IsLiveGrouping = someNullableBool ?? false;","handlingStrategy":"validation","validationCode":"if (flag == null) throw new ArgumentException(\"IsLiveGrouping requires true/false\");\nview.IsLiveGrouping = flag.Value;","typeGuard":"bool isValidLiveGroupingValue(bool? v) => v is true or false;","tryCatchPattern":"try { view.IsLiveGrouping = flag; }\ncatch (ArgumentNullException) { view.IsLiveGrouping = false; }","preventionTips":["Coalesce nullable bools before assigning (flag ?? false)","Use plain bool (not bool?) as the binding source type","Never 'clear' live grouping with null; assign false"],"tags":["wpf","data-binding","null-argument","live-grouping"],"backgroundTag":"null-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}