AvaloniaUI/Avalonia · error · InvalidOperationException

No Setter property assigned.

Error message

No Setter property assigned.

What it means

Thrown during Animation.InterpretKeyframes when a Setter inside a KeyFrame has a null Property. Each setter must target a specific AvaloniaProperty; a null Property makes the keyframe meaningless and prevents animator resolution, so Avalonia fails fast during the animation setup pass.

Source

Thrown at src/Avalonia.Base/Animation/Animation.cs:231

                return type;
            }
            return null;
        }

        private (IList<IAnimator> Animators, IList<IDisposable> subscriptions, bool animatesVisibility) InterpretKeyframes(Animatable control)
        {
            var handlerList = new Dictionary<(Type type, AvaloniaProperty Property), Func<IAnimator>>();
            var animatorKeyFrames = new List<AnimatorKeyFrame>();
            var subscriptions = new List<IDisposable>();
            var animatesVisibility = false;

            foreach (var keyframe in Children)
            {
                foreach (var setter in keyframe.Setters)
                {
                    if (setter.Property is null)
                    {
                        throw new InvalidOperationException("No Setter property assigned.");
                    }

                    if (setter.Property == Visual.IsVisibleProperty)
                        animatesVisibility = true;

                    var handler = Animation.GetAnimator(setter) ?? GetAnimatorType(setter.Property);

                    if (handler == null)
                    {
                        throw new InvalidOperationException($"No animator registered for the property {setter.Property}. Add an animator to the Animation.Animators collection that matches this property to animate it.");
                    }

                    var (type, factory) = handler.Value;

                    if (!handlerList.ContainsKey((type, setter.Property)))
                        handlerList[(type, setter.Property)] = factory;

                    var cue = keyframe.Cue;

View on GitHub (pinned to 11c5427268)

Solutions

  1. Add the Property attribute to every Setter in the animation's keyframes (e.g. <Setter Property="Opacity" Value="1"/>).
  2. If constructing Setters in code, always assign setter.Property = SomeControl.SomeProperty before adding to the keyframe.
  3. Validate all Setters in a KeyFrame have a non-null Property before running/initializing the animation.
  4. After renaming an AvaloniaProperty, update all animation setters referencing it.

Example fix

// before
<!-- XAML -->
<KeyFrame>
  <Setter Value="1.0"/>
</KeyFrame>

// after
<KeyFrame>
  <Setter Property="Opacity" Value="1.0"/>
</KeyFrame>
Defensive patterns

Strategy: validation

Validate before calling

// ensure every setter has a Property before running the animation
foreach (var kf in animation.Children)
    foreach (var s in kf.Setters)
        if (s.Property is null)
            throw new InvalidOperationException($"Setter is missing a Property (value={s.Value}).");

Type guard

static bool AllSettersHaveProperty(Animation a)
    => a.Children.SelectMany(k => k.Setters).All(s => s.Property is not null);

Prevention

When it happens

Trigger: Defining a KeyFrame Setter in XAML or code without specifying the Property attribute/property (e.g. <Setter Value="Red"/> missing Property=...). Also reachable by programmatically adding a Setter whose Property was never assigned.

Common situations: XAML typo omitting the Property attribute on a Setter; building Setters in code and forgetting to set .Property; copy/paste of a Setter that lost its Property binding; stale XAML after renaming/removing an AvaloniaProperty without updating the setter.

Related errors


AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13). Data as JSON: /api/errors/411abb5b14adfe3c. Report an issue: GitHub.