dotnet/wpf · error · InvalidOperationException
SR.Timing_NoTextChildren
Error message
SR.Timing_NoTextChildren
What it means
TimelineGroup.AddText always throws InvalidOperationException because timelines cannot accept text content. Text nodes appearing inside a timeline element in XAML (e.g. whitespace or stray text under <Storyboard>) have no representation and are rejected.
Solutions
- Remove any text content inside timeline elements in XAML
- Ensure only child element tags (animations/timelines) appear inside Storyboard/ParallelTimeline
- Check for invisible characters or malformed entity references inside the storyboard element
Example fix
// before <Storyboard> Some stray text <DoubleAnimation .../> </Storyboard> // after <Storyboard> <DoubleAnimation .../> </Storyboard>
Defensive patterns
Strategy: validation
Validate before calling
if (!string.IsNullOrWhiteSpace(childText)) throw new ArgumentException("Timelines accept no text content"); Try / catch
try { storyboard.AddText(text); }
catch (InvalidOperationException) { /* remove text content from timeline */ } Prevention
- Keep timeline XAML elements free of text nodes
- Check for stray characters inside <Storyboard> blocks
- Regenerate XAML from templates that guarantee element-only content
When it happens
Trigger: Calling AddText directly, or XAML parser encountering non-whitespace text content inside a Storyboard/ParallelTimeline element (often from stray characters or bad markup inside the storyboard).
Common situations: Accidental text/typo inside <Storyboard>...</Storyboard> in XAML; frameworks or tools generating XAML that inject text nodes into timeline containers.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Animation_NoTextChildren
- Animation_NoTextChildren
- SR.Animation_NoTextChildren
- SR.Animation_NoTextChildren
- SR.Animation_NoTextChildren
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/14d134fa21624cbd.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/TimelineGroup.cs:203
/// WritePreamble() or WritePostscript(). It also doesn't throw an
/// ArgumentNullException if the childText parameter is null. These tasks
/// are performed by the interface implementation. Therefore, it's OK
/// for a derived class to override this method and call the base
/// class implementation only if they determine that it's the right
/// course of action. The derived class can rely on Timeline's
/// implementation of IAddChild.AddChild or implement their own
/// following the Freezable pattern since that would be a public
/// method.
/// </remarks>
/// <param name="childText">A string representing the child text that
/// should be added. If this is a Timeline an exception will be
/// thrown.</param>
/// <exception cref="InvalidOperationException">Timelines have no way
/// of adding text.</exception>
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void AddText(string childText)
{
throw new InvalidOperationException(SR.Timing_NoTextChildren);
}
#endregion // IAddChild interface
}
}
View on GitHub (pinned to 81131a70a4)