AvaloniaUI/Avalonia · error · FormatException

Easing "{e}" was not found in {Namespace} namespace.

Error message

Easing "{e}" was not found in {Namespace} namespace.

What it means

Thrown by Easing.Parse when the input string is neither a KeySpline (comma-separated control points) nor a known easing type name in the Avalonia.Animation.Easings namespace. Easing.Parse delegates to a source-generated factory (TryCreateEasingInstance) that enumerates Easing subtypes; an unknown name yields this FormatException.

Source

Thrown at src/Avalonia.Base/Animation/Easings/Easing.cs:42

        /// <summary>
        /// Parses a Easing type string.
        /// </summary>
        /// <param name="e">The Easing type string.</param>
        /// <returns>Returns the instance of the parsed type.</returns>
        public static Easing Parse(string e)
        {
#if NETSTANDARD2_0
            if (e.Contains(","))
#else
            if (e.Contains(','))
#endif
            {
                return new SplineEasing(KeySpline.Parse(e, CultureInfo.InvariantCulture));
            }

            return TryCreateEasingInstance(e, out var easing)
                ? easing
                : throw new FormatException($"Easing \"{e}\" was not found in {Namespace} namespace.");
        }
    }
}

View on GitHub (pinned to 11c5427268)

Solutions

  1. Use a documented easing name from Avalonia.Animation.Easings (e.g. "QuadraticEaseInOut").
  2. For spline control, pass four comma-separated numbers forming a KeySpline.
  3. Instantiate the Easing subclass directly in code instead of parsing.

Example fix

// before
var e = Easing.Parse("ease-in-out"); // CSS name, not valid

// after
var e = Easing.Parse("CubicEaseInOut");
// or a spline
var e = Easing.Parse("0.25,0.1,0.25,1");
Defensive patterns

Strategy: validation

Validate before calling

var known = new[] { "LinearEasing", "QuadraticEaseIn", "CubicEaseInOut" /* ... */ };
if (!e.Contains(',') && !known.Contains(e))
    throw new FormatException($"Unknown easing: {e}");

Type guard

static bool IsKnownEasing(string e) => e.Contains(',') || typeof(Easing).Assembly.GetTypes()
    .Any(t => typeof(Easing).IsAssignableFrom(t) && t.Name == e);

Prevention

When it happens

Trigger: Calling Easing.Parse(e) where e is not a spline string and does not match any Easing subclass name (e.g. "EaseInOut", "QuadraticEaseIn").

Common situations: Typo in an easing name; using an easing from another framework's vocabulary; case mismatch; expecting an easing that was trimmed by AOT/linker.

Related errors


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