{"record":{"id":"b87e450da657394c","repo":"unoplatform/uno","slug":"no-valid-setter-found-for-attached-property-name","errorCode":null,"errorMessage":"No valid setter found for attached property {name}","messagePattern":"No valid setter found for attached property (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/RoslynMetadataHelper.cs","lineNumber":133,"sourceCode":"\t\t}\n\n\t\tpublic INamedTypeSymbol GetAttachedPropertyType(INamedTypeSymbol type, string propertyName)\n\t\t\t=> _getAttachedPropertyType(type, propertyName);\n\n\t\tprivate static INamedTypeSymbol SourceGetAttachedPropertyType(INamedTypeSymbol? type, string name)\n\t\t{\n\t\t\twhile (type != null && type.SpecialType != SpecialType.System_Object)\n\t\t\t{\n\t\t\t\tvar setMethod = type?.GetFirstMethodWithName(\"Set\" + name);\n\t\t\t\tif (setMethod?.FindDependencyPropertyType() is { } propertyType)\n\t\t\t\t{\n\t\t\t\t\treturn propertyType;\n\t\t\t\t}\n\n\t\t\t\ttype = type?.BaseType;\n\t\t\t}\n\n\t\t\tthrow new InvalidOperationException($\"No valid setter found for attached property {name}\");\n\t\t}\n\n\t\tpublic ITypeSymbol GetTypeByFullName(string fullName)\n\t\t{\n\t\t\tvar symbol = FindTypeByFullName(fullName);\n\n\t\t\tif (symbol == null)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException($\"Unable to find type {fullName}\");\n\t\t\t}\n\n\t\t\treturn symbol;\n\t\t}\n\n\t\tpublic bool IsTypeImplemented(INamedTypeSymbol type) => _isTypeImplemented(type);\n\n\t\tprivate static bool SourceIsTypeImplemented(INamedTypeSymbol type)\n\t\t\t=> type.GetAttributes().None(a => a.AttributeClass?.GetFullyQualifiedTypeExcludingGlobal() == XamlConstants.Types.NotImplementedAttribute);","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/RoslynMetadataHelper.cs#L115-L151","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"<!-- before -->\n<Grid><TextBlock Grid.Columm=\"1\" /></Grid>\n<!-- after -->\n<Grid><TextBlock Grid.Column=\"1\" /></Grid>","handlingStrategy":"validation","validationCode":"// Verify an attached property exists on its owner before relying on it in XAML\nvar setter = ownerType.GetMethod(\"Set\" + propertyName, new[] { typeof(DependencyObject), propertyType });\nif (setter == null) throw new InvalidOperationException($\"No Set{propertyName} on {ownerType}.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["roslyn","xaml","attached-property","type-resolution","source-generator"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}