{"record":{"id":"3d6e1c4096553027","repo":"dotnet/wpf","slug":"pointkeyframecollection-0","errorCode":null,"errorMessage":"PointKeyFrameCollection[{0}]","messagePattern":"PointKeyFrameCollection\\[(.+?)\\]","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/PointKeyFrameCollection.cs","lineNumber":466,"sourceCode":"            }\n        }\n\n        /// <summary>\n        /// Gets or sets the PointKeyFrame at a given index.\n        /// </summary>\n        public PointKeyFrame 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, \"PointKeyFrameCollection[{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/PointKeyFrameCollection.cs#L448-L484","documentation":"PointKeyFrameCollection's this[index] setter throws ArgumentNullException with the message \"PointKeyFrameCollection[{0}]\" (index interpolated) when a null PointKeyFrame is stored into the collection. Unlike most ArgumentNullExceptions the message is the formatted parameter name, so the exception's message looks like a collection indexer label. The collection enforces that every slot holds a real key frame.","triggerScenarios":"Assigning null via the indexer: myKeyFrameCollection[i] = null; or via databinding/tools that write null into a collection item slot.","commonSituations":"Programmatically building key frame animations where a key frame variable was never created; templated/generic code that clears items by assigning null instead of calling RemoveAt; deserialization producing null entries.","solutions":["Assign a valid PointKeyFrame instance instead of null.","Use RemoveAt(index) to remove an entry rather than setting the slot to null.","Null-check the key frame variable before indexing into the collection.","Catch ArgumentNullException around collection writes if items come from external data."],"exampleFix":"// before\nkeyFrames[0] = null;\n// after\nkeyFrames.RemoveAt(0);\n// or\nkeyFrames[0] = new LinearPointKeyFrame(new Point(10,10), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1)));","handlingStrategy":"type-guard","validationCode":"if (frame != null) collection[index] = frame; else collection.RemoveAt(index);","typeGuard":"static bool IsStorableKeyFrame(PointKeyFrame f) => f != null;","tryCatchPattern":"try { collection[i] = frame; }\ncatch (ArgumentNullException) { collection.RemoveAt(i); }","preventionTips":["Use RemoveAt instead of assigning null","Null-check key frame variables before writing","Validate deserialized collections for null entries"],"tags":["wpf","animation","null-argument","collection"],"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"}