unoplatform/uno · error · InvalidOperationException
No valid setter found for attached property {name}
Error message
No valid setter found for attached property {name} What it means
To resolve an attached property's value type, the generator walks the owner type's hierarchy looking for a 'Set<Name>' method whose return yields a DependencyProperty type. If no such setter is found up to System.Object, it throws InvalidOperationException. This indicates the attached property name is wrong or the owner does not define it.
Source
Thrown at src/SourceGenerators/Uno.UI.SourceGenerators/RoslynMetadataHelper.cs:133
}
public INamedTypeSymbol GetAttachedPropertyType(INamedTypeSymbol type, string propertyName)
=> _getAttachedPropertyType(type, propertyName);
private static INamedTypeSymbol SourceGetAttachedPropertyType(INamedTypeSymbol? type, string name)
{
while (type != null && type.SpecialType != SpecialType.System_Object)
{
var setMethod = type?.GetFirstMethodWithName("Set" + name);
if (setMethod?.FindDependencyPropertyType() is { } propertyType)
{
return propertyType;
}
type = type?.BaseType;
}
throw new InvalidOperationException($"No valid setter found for attached property {name}");
}
public ITypeSymbol GetTypeByFullName(string fullName)
{
var symbol = FindTypeByFullName(fullName);
if (symbol == null)
{
throw new InvalidOperationException($"Unable to find type {fullName}");
}
return symbol;
}
public bool IsTypeImplemented(INamedTypeSymbol type) => _isTypeImplemented(type);
private static bool SourceIsTypeImplemented(INamedTypeSymbol type)
=> type.GetAttributes().None(a => a.AttributeClass?.GetFullyQualifiedTypeExcludingGlobal() == XamlConstants.Types.NotImplementedAttribute);View on GitHub (pinned to 0418340488)
Solutions
- Correct the spelling of the attached property in XAML to match the owner's Set<Name> method.
- Verify the owner type actually declares that attached property in the referenced WinUI/Uno version.
- Add the missing xmlns/assembly reference for the owner type.
Example fix
<!-- before --> <Grid><TextBlock Grid.Columm="1" /></Grid> <!-- after --> <Grid><TextBlock Grid.Column="1" /></Grid>
Defensive patterns
Strategy: validation
Validate before calling
// Verify an attached property exists on its owner before relying on it in XAML
var setter = ownerType.GetMethod("Set" + propertyName, new[] { typeof(DependencyObject), propertyType });
if (setter == null) throw new InvalidOperationException($"No Set{propertyName} on {ownerType}."); Prevention
- Spell attached property names exactly as the owner's Set<Name> accessor.
- Confirm the owner type declares the attached property in the referenced WinUI/Uno version.
When it happens
Trigger: XAML uses an attached property (e.g. <Type>.<Name>) whose 'Set<Name>' accessor cannot be found on the owner type or any of its base types.
Common situations: A typo in the attached property name in XAML (Grid.Columm vs Grid.Column); referencing an attached property on a type that does not provide it; the owner type's setter was renamed/removed.
Related errors
- The type '{fullyQualifiedMetadataName}' is not found.
- Unable to resolve {symbol} (Reason: {errorTypeSymbol.Candida
- Unable to find type {fullName}
- Expected attached property path to be member access.
- Expected ')' in attached property syntax.
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/b87e450da657394c.
Report an issue: GitHub.