{"record":{"id":"09060a0585304e42","repo":"dotnet/wpf","slug":"decimalkeyframecollection-0","errorCode":null,"errorMessage":"DecimalKeyFrameCollection[{0}]","messagePattern":"DecimalKeyFrameCollection\\[(.+?)\\]","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/DecimalKeyFrameCollection.cs","lineNumber":466,"sourceCode":"            }\n        }\n\n        /// <summary>\n        /// Gets or sets the DecimalKeyFrame at a given index.\n        /// </summary>\n        public DecimalKeyFrame this[int index]\n        {\n            get\n            {\n                ReadPreamble();\n\n                return _keyFrames[index];\n            }\n            set\n            {\n                if (value == null)\n                {\n                    throw new ArgumentNullException(String.Format(CultureInfo.InvariantCulture, \"DecimalKeyFrameCollection[{0}]\", index));\n                }\n\n                WritePreamble();\n\n                if (value != _keyFrames[index])\n                {\n                    OnFreezablePropertyChanged(_keyFrames[index], value);\n                    _keyFrames[index] = value;\n\n                    Debug.Assert(_keyFrames[index] != null);\n\n                    WritePostscript();\n                }\n            }\n        }\n\n        #endregion\n    }","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/DecimalKeyFrameCollection.cs#L448-L484","documentation":"DecimalKeyFrameCollection's public indexer setter throws ArgumentNullException when null is assigned, with the parameter name \"DecimalKeyFrameCollection[{index}]\" identifying the slot. Every element must be a non-null DecimalKeyFrame.","triggerScenarios":"Executing decimalKeyFrames[i] = null, or downstream paths that assign a null key frame into an existing index of the collection.","commonSituations":"Data-bound sources producing null items; clear-by-assignment patterns; deserialization gaps yielding null entries.","solutions":["Assign a valid DecimalKeyFrame instance instead of null","Use RemoveAt(index) to remove the slot","Null-check the key frame before assigning","Repair the data source so it never supplies null key frames"],"exampleFix":"// before\nkeyFrames[2] = null; // ArgumentNullException\n// after\nif (frame != null) keyFrames[2] = frame; else keyFrames.RemoveAt(2);","handlingStrategy":"type-guard","validationCode":"if (frame == null) keyFrames.RemoveAt(index); else keyFrames[index] = frame;","typeGuard":"static bool IsValidDecimalKeyFrame(DecimalKeyFrame frame) => frame != null;","tryCatchPattern":"try { keyFrames[i] = frame; }\ncatch (ArgumentNullException ex) when (ex.ParamName == $\"DecimalKeyFrameCollection[{i}]\") { /* remove the slot or substitute a default frame */ }","preventionTips":["Null-check before indexer writes","RemoveAt instead of null assignment","Sanitize bound collections against null entries"],"tags":["wpf","animation","keyframes","null-argument"],"backgroundTag":"null-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}