{"record":{"id":"6223710f3873cc1a","repo":"dotnet/maui","slug":"xc0020","errorCode":"XC0020","errorMessage":"The name of the BindableProperty {0} does not end with \"Property\".","messagePattern":"The name of the BindableProperty (.+?) does not end with \"Property\"\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/BindablePropertyReferenceExtensions.cs","lineNumber":14,"sourceCode":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Xml;\nusing Mono.Cecil;\n\nnamespace Microsoft.Maui.Controls.Build.Tasks\n{\n\tstatic class BindablePropertyReferenceExtensions\n\t{\n\t\tpublic static TypeReference GetBindablePropertyType(this FieldReference bpRef, XamlCache cache, IXmlLineInfo iXmlLineInfo, ModuleDefinition module)\n\t\t{\n\t\t\tif (!bpRef.Name.EndsWith(\"Property\", StringComparison.InvariantCulture))\n\t\t\t\tthrow new BuildException(BuildExceptionCode.BPName, iXmlLineInfo, null, bpRef.Name);\n\t\t\tvar bpName = bpRef.Name.Substring(0, bpRef.Name.Length - 8);\n\t\t\tvar owner = bpRef.DeclaringType;\n\n\t\t\tvar getter = owner.GetProperty(cache, pd => pd.Name == bpName, out TypeReference declaringTypeRef)?.GetMethod;\n\t\t\tif (getter == null || getter.IsStatic || !getter.IsPublic)\n\t\t\t\tgetter = null;\n\t\t\tgetter = getter ?? owner.GetMethods(cache, md => md.Name == $\"Get{bpName}\" &&\n\t\t\t\t\t\t\t\t\t\t\t\tmd.IsStatic &&\n\t\t\t\t\t\t\t\t\t\t\t\tmd.IsPublic &&\n\t\t\t\t\t\t\t\t\t\t\t\tmd.Parameters.Count == 1 &&\n\t\t\t\t\t\t\t\t\t\t\t\tmd.Parameters[0].ParameterType.InheritsFromOrImplements(cache, module.ImportReference(cache, (\"Microsoft.Maui.Controls\", \"Microsoft.Maui.Controls\", \"BindableObject\"))), module).FirstOrDefault()?.Item1;\n\t\t\tif (getter == null)\n\t\t\t\tthrow new BuildException(BuildExceptionCode.BPName, iXmlLineInfo, null, bpName, bpRef.DeclaringType);\n\n\t\t\treturn getter.ResolveGenericReturnType(declaringTypeRef, module);\n\t\t}\n\n\t\tpublic static TypeReference GetBindablePropertyTypeConverter(this FieldReference bpRef, XamlCache cache, ModuleDefinition module)","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/BindablePropertyReferenceExtensions.cs#L1-L32","documentation":"XAML compiler (XamlC) validation, error XC0020. Every Maui BindableProperty field must follow the naming convention <Name>Property. GetBindablePropertyType checks the referenced field name ends with 'Property' and throws XC0020 if it does not, because the suffix is how XamlC derives the CLR property name to read the property's type.","triggerScenarios":"XAML sets an attribute (typically a Setter.Property or an attached-property usage) to a static field whose name does not end with 'Property' — e.g. using the CLR property name 'Spacing' where the 'SpacingProperty' field is required, or pointing at a non-BindableProperty static field.","commonSituations":"Typing the CLR wrapper name instead of the field; referencing a plain static field that is not a BindableProperty; copy-paste typos in property names.","solutions":["Use the BindableProperty field name with the 'Property' suffix (e.g. SpacingProperty, not Spacing).","Verify the field is actually a public static BindableProperty on the referenced type.","Double-check spelling against the type's documented BindableProperty fields."],"exampleFix":"<!-- before -->\n<Setter Property=\"Spacing\" Value=\"10\" />\n\n<!-- after -->\n<Setter Property=\"SpacingProperty\" Value=\"10\" />","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always reference BindableProperty fields by their full '<Name>Property' name in XAML.","When authoring BindableProperties, follow the <Name>Property naming convention exactly.","Let an IDE/snippet template generate the field + wrapper to avoid suffix typos."],"tags":["xaml","xamlc","bindableproperty","compilation"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}