{"record":{"id":"a17ce5dadaa84365","repo":"dotnet/maui","slug":"the-propertyname-of-type-name-name-is-not-pro","errorCode":null,"errorMessage":"The PropertyName of {type.Name}.{name} is not {propertyName}","messagePattern":"The PropertyName of (.+?)\\.(.+?) is not (.+?)","errorType":"exception","errorClass":"XamlParseException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Core/BindablePropertyConverter.cs","lineNumber":106,"sourceCode":"\t\t\tif (parts.Length != 2)\n\t\t\t{\n\t\t\t\tApplication.Current?.FindMauiContext()?.CreateLogger<BindablePropertyConverter>()?.LogWarning($\"Can't resolve {value}. Accepted syntax is Type.PropertyName.\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tType type = GetControlType(parts[0]);\n\t\t\treturn ConvertFrom(type, parts[1], null);\n\t\t}\n\n\t\tBindableProperty ConvertFrom(Type type, string propertyName, IXmlLineInfo lineinfo)\n\t\t{\n\t\t\tvar name = propertyName + \"Property\";\n\t\t\tFieldInfo bpinfo = GetPropertyField(type, name);\n\t\t\tif (bpinfo == null || bpinfo.FieldType != typeof(BindableProperty))\n\t\t\t\tthrow new XamlParseException($\"Can't resolve {name} on {type.Name}\", lineinfo);\n\t\t\tvar bp = bpinfo.GetValue(null) as BindableProperty;\n\t\t\tvar isObsolete = GetObsoleteAttribute(bpinfo) != null;\n\t\t\tif (bp.PropertyName != propertyName && !isObsolete)\n\t\t\t\tthrow new XamlParseException($\"The PropertyName of {type.Name}.{name} is not {propertyName}\", lineinfo);\n\t\t\treturn bp;\n\t\t}\n\n\t\t[UnconditionalSuppressMessage(\"TrimAnalysis\", \"IL2045:AttributeRemoval\",\n\t\t\tJustification = \"ObsoleteAttribute instances are removed by the trimmer in production builds.\")]\n\t\tstatic ObsoleteAttribute GetObsoleteAttribute(FieldInfo fieldInfo)\n\t\t\t=> fieldInfo.GetCustomAttribute<ObsoleteAttribute>();\n\n\t\t[UnconditionalSuppressMessage(\"TrimAnalysis\", \"IL2057:TypeGetType\",\n\t\t\tJustification = \"The converter is only used when parsing XAML at runtime. The developer will receive a warning \" +\n\t\t\t\t\"saying that parsing XAML at runtime may not work as expected when trimming.\")]\n\t\tstatic Type GetControlType(string typeName)\n\t\t\t=> Type.GetType(\"Microsoft.Maui.Controls.\" + typeName);\n\n\t\t[UnconditionalSuppressMessage(\"TrimAnalysis\", \"IL2070:UnrecognizedReflectionPattern\",\n\t\t\tJustification = \"The converter is only used when parsing XAML at runtime. The developer will receive a warning \" +\n\t\t\t\t\"saying that parsing XAML at runtime may not work as expected when trimming.\")]\n\t\tstatic FieldInfo GetPropertyField(Type type, string fieldName)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Core/BindablePropertyConverter.cs#L88-L124","documentation":"XamlParseException raised when the BindableProperty field was found but its registered PropertyName does not match the propertyName the XAML used. MAUI cross-checks to catch renamed-but-not-updated XAML; the only exception is when the field is marked [Obsolete] (the converter then tolerates the old name). Otherwise the field and the XAML name must agree.","triggerScenarios":"A field named FooProperty whose BindableProperty.Create registered PropertyName=\"Bar\"; a refactor that renamed the C# property but not the registered PropertyName; XAML referencing the old name while the registered name changed and the field is not [Obsolete].","commonSituations":"Splitting a rename across two commits; third-party control that registered a different PropertyName than the field name suggests; generated BindableProperties where the generator and the registration disagree.","solutions":["Align the XAML attribute with the registered PropertyName (what was passed to Create).","Or mark the field [Obsolete] and keep the old XAML name as an alias.","Rebuild after fixing so XAMLC re-validates."],"exampleFix":"// before: field named TitleProperty but registered as 'Heading'\npublic static readonly BindableProperty TitleProperty =\n    BindableProperty.Create(nameof(Heading), typeof(string), typeof(V), default);\n\n// after: align names\npublic static readonly BindableProperty TitleProperty =\n    BindableProperty.Create(nameof(Title), typeof(string), typeof(V), default);","handlingStrategy":"validation","validationCode":"// At authoring time, verify the registered PropertyName matches the field name suffix:\nvar bp = (BindableProperty)fi.GetValue(null);\nif (bp.PropertyName != expectedName && !fi.IsDefined(typeof(ObsoleteAttribute)))\n    /* flag mismatch */","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rename the C# property and the registered PropertyName together.","Mark deprecated fields [Obsolete] if you must keep an alias."],"tags":["maui","xaml","bindableproperty","converter","rename","obsolete"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}