{"record":{"id":"9c8e0aace135ed4c","repo":"dotnet/wpf","slug":"int16keyframecollection-0","errorCode":null,"errorMessage":"Int16KeyFrameCollection[{0}]","messagePattern":"Int16KeyFrameCollection\\[(.+?)\\]","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/Int16KeyFrameCollection.cs","lineNumber":466,"sourceCode":"            }\n        }\n\n        /// <summary>\n        /// Gets or sets the Int16KeyFrame at a given index.\n        /// </summary>\n        public Int16KeyFrame 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, \"Int16KeyFrameCollection[{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/Int16KeyFrameCollection.cs#L448-L484","documentation":"The Int16KeyFrameCollection indexer setter throws ArgumentNullException with message \"Int16KeyFrameCollection[{index}]\" when a null Int16KeyFrame is assigned at the specified index. Null key frames are rejected to preserve collection invariants.","triggerScenarios":"Executing int16KeyFrameCollection[index] = null, or an automated/XAML path inserting a null key frame at an index.","commonSituations":"Building key-frame collections from data where entries can be null; factory/helper methods returning null frames that are then indexed into the collection.","solutions":["Check for null before assigning a frame into the collection","Filter null entries out before populating KeyFrames","Use a valid default frame instead of a null placeholder"],"exampleFix":"// before\nframes[i] = BuildFrame(i); // can be null\n// after\nvar f = BuildFrame(i);\nif (f != null) frames[i] = f;","handlingStrategy":"type-guard","validationCode":"if (frame == null) throw new ArgumentNullException(nameof(frame));\ncollection[index] = frame;","typeGuard":"static bool IsValidFrame(Int16KeyFrame f) => f != null;","tryCatchPattern":"try { collection[index] = frame; } catch (ArgumentNullException ex) when (ex.Message.StartsWith(\"Int16KeyFrameCollection[\")) { /* supply non-null frame */ }","preventionTips":["Null-check frames returned from helpers before inserting them","Sanitize input data lists (remove nulls) when generating key-frame collections","Substitute valid default frames rather than null placeholders"],"tags":["wpf","animation","keyframes","null","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-21T21:30:21.729Z"}