{"record":{"id":"d3aaaef8c14480a0","repo":"dotnet/wpf","slug":"doublekeyframecollection-0","errorCode":null,"errorMessage":"DoubleKeyFrameCollection[{0}]","messagePattern":"DoubleKeyFrameCollection\\[(.+?)\\]","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/DoubleKeyFrameCollection.cs","lineNumber":466,"sourceCode":"            }\n        }\n\n        /// <summary>\n        /// Gets or sets the DoubleKeyFrame at a given index.\n        /// </summary>\n        public DoubleKeyFrame 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, \"DoubleKeyFrameCollection[{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/DoubleKeyFrameCollection.cs#L448-L484","documentation":"The DoubleKeyFrameCollection indexer setter throws ArgumentNullException whose message is \"DoubleKeyFrameCollection[{index}]\" when a null DoubleKeyFrame is assigned at the given index. Null key frames are not permitted in the collection.","triggerScenarios":"Executing collection[index] = null on a DoubleKeyFrameCollection, or XAML/serialization paths inserting a null key frame at an index.","commonSituations":"Programmatic population of key frames where a null slipped through (e.g. a factory method returned null); data-driven construction of animations from a list containing nulls.","solutions":["Ensure the DoubleKeyFrame instance is non-null before assigning into the collection","Filter nulls from source lists before building the collection","If a placeholder is needed, use a key frame with a valid value instead of null"],"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) throw new ArgumentNullException(nameof(frame));\ncollection[index] = frame;","typeGuard":"static bool IsValidFrame(DoubleKeyFrame f) => f != null;","tryCatchPattern":"try { collection[index] = frame; } catch (ArgumentNullException ex) when (ex.Message.StartsWith(\"DoubleKeyFrameCollection[\")) { /* supply a non-null frame */ }","preventionTips":["Guard factory methods that may return null frames before indexing into the collection","Filter nulls out of source data when programmatically building key-frame collections","Use non-null placeholder key frames instead of null slots"],"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-22T01:17:13.364Z"}