{"record":{"id":"39fc745c87e774c5","repo":"dotnet/maui","slug":"can-t-resolve-name-on-type-name","errorCode":null,"errorMessage":"Can't resolve {name} on {type.Name}","messagePattern":"Can't resolve (.+?) on (.+?)","errorType":"exception","errorClass":"XamlParseException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Core/BindablePropertyConverter.cs","lineNumber":102,"sourceCode":"\t\t\t\tApplication.Current?.FindMauiContext()?.CreateLogger<BindablePropertyConverter>()?.LogWarning(\"Can't resolve properties with xml namespace prefix.\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tstring[] parts = strValue.Split('.');\n\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","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Core/BindablePropertyConverter.cs#L84-L120","documentation":"XamlParseException raised by ConvertFrom when, having resolved the owning Type and built the field name (propertyName + \"Property\"), GetPropertyField returns null or a field whose type is not BindableProperty. The named BindableProperty field simply does not exist on that type (public static, flattened up the hierarchy).","triggerScenarios":"Property=\"MyCtrl.Foo\" when MyCtrl has no FooProperty field; misspelling the property name; referencing a property that was renamed or removed; the field exists but is not declared as BindableProperty.","commonSituations":"Typo in property name; renaming a BindableProperty without updating XAML; referencing a control version where the property did not yet exist.","solutions":["Verify the exact property name spelling against the control's API surface.","If the property was renamed, update the XAML to the new name.","Ensure the control version referenced actually declares that BindableProperty."],"exampleFix":"<!-- before -->\n<Setter Property=\"local:MyCtrl.Titel\" Value=\"x\" />\n\n<!-- after -->\n<Setter Property=\"local:MyCtrl.Title\" Value=\"x\" />","handlingStrategy":"validation","validationCode":"// Cross-check at authoring time: the type must expose a static BindableProperty field\n// named <PropertyName>Property.\nvar fi = ownerType.GetProperty($\"{propName}Property\", BindingFlags.Public | BindingFlags.Static);\nif (fi?.FieldType != typeof(BindableProperty)) /* flag the typo */","typeGuard":"static bool PropertyExistsOnType(Type t, string propName) =>\n    t.GetField(propName + \"Property\", BindingFlags.Public | BindingFlags.Static)?.FieldType\n    == typeof(Microsoft.Maui.Controls.BindableProperty);","tryCatchPattern":null,"preventionTips":["Cross-reference XAML property names against the control's API docs.","Rebuild XAMLC early to catch missing property fields."],"tags":["maui","xaml","bindableproperty","converter","type-resolution"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}