AvaloniaUI/Avalonia · error · InvalidOperationException

Attached properties not supported.

Error message

Attached properties not supported.

What it means

Thrown by AvaloniaPropertyRegistry.FindRegistered(Type, string) when the requested property name contains a dot. Dotted names (e.g. 'Grid.Row') denote attached properties, which this by-name lookup API does not resolve — attached properties live in a separate registry and must be looked up via the attached-property APIs.

Source

Thrown at src/Avalonia.Base/AvaloniaPropertyRegistry.cs:287

        /// <summary>
        /// Finds a registered property on a type by name.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="name">The property name.</param>
        /// <returns>
        /// The registered property or null if no matching property found.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        /// The property name contains a '.'.
        /// </exception>
        public AvaloniaProperty? FindRegistered(Type type, string name)
        {
            _ = type ?? throw new ArgumentNullException(nameof(type));
            _ = name ?? throw new ArgumentNullException(nameof(name));

            if (name.Contains('.'))
            {
                throw new InvalidOperationException("Attached properties not supported.");
            }

            var registered = GetRegistered(type);
            var registeredCount = registered.Count;

            for (var i = 0; i < registeredCount; i++)
            {
                AvaloniaProperty x = registered[i];

                if (x.Name == name)
                {
                    return x;
                }
            }

            return null;
        }

View on GitHub (pinned to 11c5427268)

Solutions

  1. Strip the 'OwnerType.' prefix and resolve the attached property through GetRegisteredAttached(type) / Find on the attached registry instead.
  2. Use the property name without the dot for non-attached lookups.
  3. Detect the dot up front and branch to the attached-property resolution path.

Example fix

// before
var p = registry.FindRegistered(type, "Canvas.Left");

// after
if (name.Contains('.')) {
    var attached = registry.GetRegisteredAttached(type)
        .FirstOrDefault(a => a.Name == name.Split('.')[1]);
} else {
    var p = registry.FindRegistered(type, name);
}
Defensive patterns

Strategy: validation

Validate before calling

if (name.Contains('.')) { /* resolve via GetRegisteredAttached instead */ }

Type guard

static bool IsPlainPropertyName(string name) => !name.Contains('.');

Prevention

When it happens

Trigger: Calling FindRegistered(type, "OwnerType.PropertyName") or FindRegistered(obj, "Canvas.Left"); passing an XAML-style attached property path to the non-attached name-based lookup.

Common situations: Binding or styling code that passes an attached-property qualified name where a plain CLR property name is expected; XAML parser or reflection code forwarding a dotted path into FindRegistered.

Related errors


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