{"record":{"id":"e0b59517d01b8a22","repo":"dotnet/maui","slug":"can-t-resolve-0","errorCode":null,"errorMessage":"Can't resolve {0}","messagePattern":"Can't resolve (.+?)","errorType":"exception","errorClass":"XamlParseException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Core/BindablePropertyConverter.cs","lineNumber":42,"sourceCode":"\t\tobject IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)\n\t\t{\n\t\t\tif (string.IsNullOrWhiteSpace(value))\n\t\t\t\treturn null;\n\t\t\tif (serviceProvider == null)\n\t\t\t\treturn null;\n\t\t\tif (!(serviceProvider.GetService(typeof(IXamlTypeResolver)) is IXamlTypeResolver typeResolver))\n\t\t\t\treturn null;\n\t\t\tIXmlLineInfo lineinfo = null;\n\t\t\tif (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) is IXmlLineInfoProvider xmlLineInfoProvider)\n\t\t\t\tlineinfo = xmlLineInfoProvider.XmlLineInfo;\n\t\t\tstring[] parts = value.Split('.');\n\t\t\tType type = null;\n\t\t\tif (parts.Length == 1)\n\t\t\t{\n\t\t\t\tif (!(serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideParentValues parentValuesProvider))\n\t\t\t\t{\n\t\t\t\t\tstring msg = string.Format(\"Can't resolve {0}\", parts[0]);\n\t\t\t\t\tthrow new XamlParseException(msg, lineinfo);\n\t\t\t\t}\n\t\t\t\tobject parent = parentValuesProvider.ParentObjects.Skip(1).FirstOrDefault();\n\t\t\t\tif (parentValuesProvider.TargetObject is Setter)\n\t\t\t\t{\n\t\t\t\t\tif (parent is Style style)\n\t\t\t\t\t\ttype = style.TargetType;\n\t\t\t\t\telse if (parent is TriggerBase triggerBase)\n\t\t\t\t\t\ttype = triggerBase.TargetType;\n\t\t\t\t\telse if (parent is VisualState visualState)\n\t\t\t\t\t\ttype = FindTypeForVisualState(parentValuesProvider, lineinfo);\n\t\t\t\t}\n\t\t\t\telse if (parentValuesProvider.TargetObject is Trigger)\n\t\t\t\t\ttype = (parentValuesProvider.TargetObject as Trigger).TargetType;\n\t\t\t\telse if (parentValuesProvider.TargetObject is PropertyCondition && parent is TriggerBase)\n\t\t\t\t\ttype = (parent as TriggerBase).TargetType;\n\n\t\t\t\tif (type == null)\n\t\t\t\t\tthrow new XamlParseException($\"Can't resolve {parts[0]}\", lineinfo);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Core/BindablePropertyConverter.cs#L24-L60","documentation":"XamlParseException raised by BindablePropertyConverter when converting a single-segment property name (no dot) and the XAML service provider cannot supply IProvideParentValues. Without parent information the converter cannot infer the target Type that owns the property, so it cannot resolve the bare name. Thrown during XAML parsing/compilation, not at runtime binding.","triggerScenarios":"Authoring a Setter.Property or similar attribute with a bare name (e.g. Property=\"BackgroundColor\") in a context where the XAML loader did not provide IProvideValueTarget/IProvideParentValues; loading XAML via a custom service provider that omits these services; runtime XAML inflation in unit tests without the full MAUI service container.","commonSituations":"Using XamlReader.Load directly without wiring the MAUI services; third-party XAML hosts that do not implement IProvideParentValues; XAMLC source-generator running on malformed Setter markup.","solutions":["Prefix the property with its owner type, e.g. Property=\"VisualElement.BackgroundColor\", so the converter does not need parent inference.","If you inflate XAML manually, supply an IProvideValueTarget/IProvideParentValues service in the serviceProvider.","Run the XAML through the compiled XAMLC path in a real MAUI host instead of a bare XamlReader."],"exampleFix":"<!-- before -->\n<Setter Property=\"BackgroundColor\" Value=\"Red\" />\n\n<!-- after -->\n<Setter Property=\"VisualElement.BackgroundColor\" Value=\"Red\" />","handlingStrategy":"validation","validationCode":"// In XAML: always qualify the property when parent services are unavailable.\n// <Setter Property=\"VisualElement.BackgroundColor\" Value=\"Red\" />","typeGuard":null,"tryCatchPattern":"try { /* XAML load */ }\ncatch (XamlParseException ex) when (ex.Message.StartsWith(\"Can't resolve\"))\n{\n    // log and fall back to qualifying the property name manually\n}","preventionTips":["Qualify Setter.Property with the owner type in shared/reusable XAML.","Provide a full MAUI service container when inflating XAML at runtime."],"tags":["maui","xaml","bindableproperty","converter","setter"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}