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
- Strip the 'OwnerType.' prefix and resolve the attached property through GetRegisteredAttached(type) / Find on the attached registry instead.
- Use the property name without the dot for non-attached lookups.
- 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
- Detect dotted names before calling FindRegistered and route to the attached-property API.
- Keep attached-property qualified names out of non-attached lookups.
- Validate input names at the boundary (binding/XAML parser).
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
- Cannot register a non-attached property as attached.
- Duration value cannot be negative.
- DelayBetweenIterations value cannot be negative.
- IterationCount value cannot be larger than long.MaxValue.
- This cue object's value should be within or equal to 0.0 and
AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13).
Data as JSON: /api/errors/f96a7dabe9aba9e7.
Report an issue: GitHub.