{"record":{"id":"4d25bb009092b8f1","repo":"dotnet/wpf","slug":"sr-animation-notextchildren-doubleanimationusingkeyframes","errorCode":null,"errorMessage":"SR.Animation_NoTextChildren","messagePattern":"SR\\.Animation_NoTextChildren","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/DoubleAnimationUsingKeyFrames.cs","lineNumber":277,"sourceCode":"        /// WritePreamble() or WritePostscript().  It also doesn't throw an\n        /// ArgumentNullException if the childText parameter is null.  These tasks\n        /// are performed by the interface implementation.  Therefore, it's OK\n        /// for a derived class to override this method and call the base\n        /// class implementation only if they determine that it's the right\n        /// course of action.  The derived class can rely on KeyFrameAnimation's\n        /// implementation of IAddChild.AddChild or implement their own\n        /// following the Freezable pattern since that would be a public\n        /// method.\n        /// </remarks>\n        /// <param name=\"childText\">A string representing the child text that\n        /// should be added.  If this is a KeyFrameAnimation an exception will be\n        /// thrown.</param>\n        /// <exception cref=\"InvalidOperationException\">Timelines have no way\n        /// of adding text.</exception>\n        [EditorBrowsable(EditorBrowsableState.Advanced)]\n        protected virtual void AddText(string childText)\n        {\n            throw new InvalidOperationException(SR.Animation_NoTextChildren);\n        }\n\n        #endregion\n\n        #region DoubleAnimationBase\n\n        /// <summary>\n        /// Calculates the value this animation believes should be the current value for the property.\n        /// </summary>\n        /// <param name=\"defaultOriginValue\">\n        /// This value is the suggested origin value provided to the animation\n        /// to be used if the animation does not have its own concept of a\n        /// start value. If this animation is the first in a composition chain\n        /// this value will be the snapshot value if one is available or the\n        /// base property value if it is not; otherise this value will be the \n        /// value returned by the previous animation in the chain with an \n        /// animationClock that is not Stopped.\n        /// </param>","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Generated/DoubleAnimationUsingKeyFrames.cs#L259-L295","documentation":"DoubleAnimationUsingKeyFrames.AddText throws InvalidOperationException(SR.Animation_NoTextChildren) because timelines cannot accept text content. It exists only to satisfy the IAddChild contract and always throws. Text placed inside the element's tags in XAML triggers this.","triggerScenarios":"Including literal text content inside a <DoubleAnimationUsingKeyFrames> element in XAML (e.g. stray text, whitespace-plus-characters, or mistaken inner text), which routes through IAddChild.AddText.","commonSituations":"XAML authoring mistakes such as typing a value directly inside the animation element instead of on a key frame's Value attribute; copy/paste artifacts leaving text nodes inside the element.","solutions":["Remove all text content from the DoubleAnimationUsingKeyFrames element","Set values via KeyFrame child elements' Value/KeyTime attributes instead","Replace a text-specified value with <LinearDoubleKeyFrame Value=\"...\" KeyTime=\"...\"/>"],"exampleFix":"// before (XAML)\n<DoubleAnimationUsingKeyFrames>\n  0;50;100\n</DoubleAnimationUsingKeyFrames>\n// after\n<DoubleAnimationUsingKeyFrames>\n  <LinearDoubleKeyFrame Value=\"0\" KeyTime=\"0:0:0\" />\n  <LinearDoubleKeyFrame Value=\"100\" KeyTime=\"0:0:1\" />\n</DoubleAnimationUsingKeyFrames>","handlingStrategy":"validation","validationCode":"// Before saving XAML, ensure animation elements have no inner text nodes:\n// XElement.Parse(xaml).Descendants().Where(e => e.HasContent && e.Nodes().Any(n => n is XText t && !string.IsNullOrWhiteSpace(t.Value)))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never put text content inside timeline elements in XAML","Express key values via child key-frame elements' Value attributes","Run XAML through a schema/lint that flags text content in IAddChild container elements"],"tags":["wpf","animation","xaml","unsupported-operation","text-content"],"backgroundTag":"unsupported-operation","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"}