{"record":{"id":"a317b085c206897e","repo":"dotnet/wpf","slug":"int32keyframecollection-0","errorCode":null,"errorMessage":"Int32KeyFrameCollection[{0}]","messagePattern":"Int32KeyFrameCollection\\[(.+?)\\]","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/Int32KeyFrameCollection.cs","lineNumber":466,"sourceCode":"            }\n        }\n\n        /// <summary>\n        /// Gets or sets the Int32KeyFrame at a given index.\n        /// </summary>\n        public Int32KeyFrame 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, \"Int32KeyFrameCollection[{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/Int32KeyFrameCollection.cs#L448-L484","documentation":"The Int32KeyFrameCollection indexer setter throws ArgumentNullException whose message is the formatted string 'Int32KeyFrameCollection[{index}]' when a null key frame is assigned at an index. Null key frames are not permitted in the collection.","triggerScenarios":"Executing keyFrames[index] = null; on an Int32KeyFrameCollection.","commonSituations":"Programmatic construction of key-frame collections where a frame variable is unexpectedly null; deserialization or data-binding producing null frames.","solutions":["Check the key frame for null before assigning into the collection.","Only add Int32KeyFrame instances that were successfully constructed.","Log/validate the source of the null frame upstream."],"exampleFix":"// before\nkeyFrames[0] = GetFrame(); // may return null\n// after\nvar frame = GetFrame();\nif (frame != null) keyFrames[0] = frame;","handlingStrategy":"type-guard","validationCode":"if (frame == null)\n    throw new InvalidOperationException($\"No key frame available for index {index}; refusing to insert null into Int32KeyFrameCollection.\");","typeGuard":"bool IsValidFrame(Int32KeyFrame f) => f != null;","tryCatchPattern":"try { keyFrames[index] = frame; }\ncatch (ArgumentNullException ex) when (ex.Message.Contains(\"Int32KeyFrameCollection[\")) {\n    // substitute a valid default key frame or log and skip\n}","preventionTips":["Null-check frames from factories/lookups before inserting","Initialize key frame collections with concrete instances","Add unit tests covering frame collection construction with generated data"],"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-21T21:30:21.729Z"}