dotnet/wpf · error · InvalidOperationException

Timing_SkipToFillDestinationIndefinite

Timing_SkipToFillDestinationIndefinite

Error message

SR.Timing_SkipToFillDestinationIndefinite (Timing_SkipToFillDestinationIndefinite)

What it means

InternalSkipToFill asks the clock to jump to its fill state at the end of its active period. If the clock's effective duration cannot be resolved (indefinite, e.g. Duration=Forever or unresolved), there is no end to seek to, so WPF throws InvalidOperationException with Timing_SkipToFillDestinationIndefinite. The library refuses to fill a timeline that never ends.

Solutions

  1. Give the timeline a concrete Duration (TimeSpan) so a fill destination exists
  2. Replace SkipToFill with Seek(ResolvedDuration, TimeSeekOrigin.Duration) only after verifying duration.HasTimeSpan
  3. If the intent is 'hold last frame', set FillBehavior.HoldEnd and stop/pause the clock instead of skipping to fill
  4. Guard with timeline.GetNaturalDuration(clock) or ComputeEffectiveDuration before calling

Example fix

// before
myAnimation.Duration = Duration.Forever;
clock.Controller.SkipToFill(); // throws
// after
myAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
clock.Controller.SkipToFill();
Defensive patterns

Strategy: validation

Validate before calling

var dur = timeline.Duration;
bool canSkipToFill = dur.HasTimeSpan || timeline.RepeatBehavior.HasDuration;
if (!canSkipToFill) throw new InvalidOperationException("Timeline has indefinite duration; SkipToFill is invalid.");

Try / catch

try { clock.Controller.SkipToFill(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("SkipToFill") || ex.Message.Contains("indefinite")) { /* fall back to Seek with Begin origin or stop clock */ }

Prevention

When it happens

Trigger: Calling SkipToFill() on a clock/timeline whose effective duration is null — e.g. a Timeline with Duration="Forever", or a ParallelTimeline whose children make the effective duration unresolvable. Also reached indirectly from ClockController and Begin methods that call InternalSkipToFill.

Common situations: Developers set RepeatBehavior="Forever" or Duration="Forever" on an animation/storyboard and then call SkipToFill to snap the visual to its end state; or they resolve a storyboard dynamically and the duration hasn't been resolved yet at seek time.

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


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/251c594bfaf5693d. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Clock.cs:969

        }


        /// <summary>
        /// Internal helper. Schedules an end for some specified time in the future.
        /// </summary>
        internal void InternalSkipToFill()
        {
            Debug.Assert(IsRoot);
            
            TimeSpan? effectiveDuration;

            effectiveDuration = ComputeEffectiveDuration();

            // Throw an exception if the active period extends forever.
            if (effectiveDuration == null)
            {
                // Can't seek to the end if the simple duration is not resolved
                throw new InvalidOperationException(SR.Timing_SkipToFillDestinationIndefinite);
            }

            // Offset to the end; override preceding seek requests
            IsInteractivelyStopped = false;
            PendingInteractiveStop = false;
            ResetNodesWithSlip();  // Reset sync tracking

            RootBeginPending = false;
            _rootData.PendingSeekDestination = effectiveDuration.Value;  // Seek to the end time

            NotifyNewEarliestFutureActivity();
        }


        /// <summary>
        /// Internal helper for moving to new API. Removes a timeline from its active or fill period.
        /// Timeline can be restarted with an interactive Begin call.
        /// </summary>

View on GitHub (pinned to 81131a70a4)