dotnet/wpf · error · InvalidOperationException

SR.Format(SR.Storyboard_PropertyPathUnresolved, path.Path)

Error message

SR.Format(SR.Storyboard_PropertyPathUnresolved, path.Path)

What it means

Thrown by Storyboard.ProcessComplexPath when a complex property path (e.g. '(0).(1)' with attached/complex path syntax) failed to resolve to a concrete target object and DependencyProperty. The library requires the path to end in an animatable dependency property on a non-null target; if any of animatedObject, animatedProperty, or targetProperty is null after walking the path, the path string is unresolvable and animating cannot proceed.

Solutions

  1. Verify every segment of the PropertyPath string matches real property names and that the target object exists in the visual/logical tree at Begin time.
  2. Ensure the path's final accessor is an actual DependencyProperty (not a CLR property or MethodInfo-only path).
  3. Delay calling Begin until the target element is loaded (e.g. handle Loaded event) so path resolution finds the object.
  4. If the target type genuinely doesn't support complex paths, restructure the animation to target the property directly instead.

Example fix

// before
storyboard.Begin(border, true); // path '(0).(1)' resolves to null
// after
if (border != null && VisualTreeHelper.GetParent(border) != null)
{
    storyboard.Begin(border, true); // target present in tree; path resolves
}
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the target manually before Begin
var target = this.FindName(targetName) as FrameworkElement;
if (target == null) throw new InvalidOperationException("Storyboard target not found: " + targetName);
var dp = MyControl.SomeProperty; // confirm the path's final property is a DP
if (!storyboard.Children.All(a => Storyboard.GetTargetProperty(a) != null)) throw new InvalidOperationException("TargetProperty unset");

Type guard

bool IsAnimatableProperty(object o, PropertyPath path) => o is DependencyObject && path != null && path.Path != null;

Try / catch

try { storyboard.Begin(target, true); }
catch (InvalidOperationException ex) when (ex.Message.Contains("path")) { /* log unresolved path, fall back to direct targeting */ }

Prevention

When it happens

Trigger: Calling Storyboard.Begin/ApplyAnimationClock on a storyboard whose TargetProperty uses complex path syntax where an intermediate element is null, the final accessor is not a DependencyProperty, or the resolved targetProperty is null. Typically the PropertyPath string does not match the actual object graph.

Common situations: Typo'd or stale property-path strings (e.g. '(Window.ActualWidth)' misspelled), targeting a child that hasn't been loaded into the tree yet, animating a plain CLR property instead of a DependencyProperty, or XAML resource renames leaving the storyboard path pointing at a removed element.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Media/Animation/Storyboard.cs:843

        //  completely ignored.

        DependencyProperty targetProperty   = path.GetAccessor(0) as DependencyProperty;

        // Two different ways to deal with property paths.  If the target is
        //  on a frozen Freezable, we'll have to make a clone of the value and
        //  attach the animation on the clone instead.
        // For all other objects, we attach the animation clock directly on the
        //  specified animating object and property.
        object targetPropertyValue = targetObject.GetValue(targetProperty);

        DependencyObject   animatedObject   = path.LastItem as DependencyObject;
        DependencyProperty animatedProperty = path.LastAccessor as DependencyProperty;

        if( animatedObject == null ||
            animatedProperty == null ||
            targetProperty == null )
        {
            throw new InvalidOperationException(SR.Format(SR.Storyboard_PropertyPathUnresolved, path.Path));
        }

        VerifyAnimationIsValid(animatedProperty, animationClock);

        if( PropertyCloningRequired( targetPropertyValue ) )
        {
            // Verify that property paths are supported for the specified
            //  object and property.  If the property value query (usually in
            //  GetValueCore) doesn't call into Storyboard code, then none of this
            //  will have any effect.  (Silently do nothing.)
            // Throwing here is for user's sake to alert that nothing will happen.
            VerifyComplexPathSupport( targetObject );

            // We need to clone the value of the target, and from here onwards
            //  try to pretend that it is the actual value.
            Debug.Assert(targetPropertyValue is Freezable, "We shouldn't be trying to clone a type we don't understand.  PropertyCloningRequired() has improperly flagged the current value as 'need to clone'.");

            // To enable animations on frozen Freezable objects, complex

View on GitHub (pinned to 81131a70a4)