AvaloniaUI/Avalonia · error · InvalidOperationException
Animator has no property specified.
Error message
Animator has no property specified.
What it means
EffectAnimatorBase.BindAnimation throws when the Animator's Property is null — it cannot bind an animation without knowing which AvaloniaProperty to drive. The animator base class requires a Property set (typically via XAML/animation registration) before binding. A null Property indicates the animator was constructed/registered without specifying its target property.
Source
Thrown at src/Avalonia.Base/Media/Effects/EffectAnimator.cs:77
/// </summary>
public override IEffect? Interpolate(double progress, IEffect? oldValue, IEffect? newValue) => progress >= 0.5 ? newValue : oldValue;
private static bool s_Registered;
public static void EnsureRegistered()
{
if(s_Registered)
return;
s_Registered = true;
}
}
internal abstract class EffectAnimatorBase<T> : Animator<IEffect?> where T : class, IEffect?
{
public override IDisposable BindAnimation(Animatable control, IObservable<IEffect?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator has no property specified.");
}
return control.Bind((AvaloniaProperty<IEffect?>)Property, instance, BindingPriority.Animation);
}
protected abstract T Interpolate(double progress, T oldValue, T newValue);
public override IEffect? Interpolate(double progress, IEffect? oldValue, IEffect? newValue)
{
var old = oldValue as T;
var n = newValue as T;
if (old == null || n == null)
return progress >= 0.5 ? newValue : oldValue;
return Interpolate(progress, old, n);
}
}
internal class BlurEffectAnimator : EffectAnimatorBase<IBlurEffect>
{View on GitHub (pinned to 11c5427268)
Solutions
- Ensure the animator's Property is set to a valid AvaloniaProperty<IEffect?> before binding/playing.
- If registering via the animation system, confirm the property is specified in the Animation/KeyFrames or registration call.
- Add a constructor or initialization that validates Property is non-null before use.
Example fix
// before
var animator = new MyEffectAnimator();
animator.BindAnimation(control, instance); // Property is null
// after
var animator = new MyEffectAnimator { Property = Visual.EffectProperty };
animator.BindAnimation(control, instance); Defensive patterns
Strategy: validation
Validate before calling
if (animator.Property is null)
throw new InvalidOperationException("Animator.Property must be set before binding.");
animator.BindAnimation(control, instance); Prevention
- Always set animator.Property (typically to an AvaloniaProperty<IEffect?>) before binding.
- Initialize animators via constructors that require the property.
- Add an assertion/guard in custom animator subclasses' BindAnimation.
When it happens
Trigger: An EffectAnimator (or subclass) instance has its Property left null when BindAnimation is called by the animation system. Typically happens during animation registration/playback if the animator wasn't fully initialized.
Common situations: Custom effect animator subclass that doesn't set Property. Registering an animation where the property binding was omitted. A XAML/C# animation definition missing the target AvaloniaProperty. Misuse of the animation API where an animator is reused without resetting Property.
Related errors
- Transitions collection cannot be reset.
- No animator registered for the property {setter.Property}. A
- Object of type '{value?.GetType()}' cannot be converted to t
- Value must be less than 10.
- Transition elements have different parents.
AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13).
Data as JSON: /api/errors/9861a866a6f45c51.
Report an issue: GitHub.