dotnet/maui · error · BuildException

XC0001

XC0001

Error message

Cannot resolve property "{0}" on type "{1} (property missing or missing accessors)".

What it means

XamlC error XC0001 (property resolution). Once the type resolves, the converter looks for a public static field named <propertyName>Property on it. If no such field exists (property missing or its accessors are inaccessible), it throws XC0001.

Source

Thrown at src/Controls/src/Build.Tasks/CompiledConverters/BindablePropertyConverter.cs:72

			else if (parts.Length == 2)
			{
				var targetType = parts[0];
				typeName = TypeArgumentsParser.ParseSingle(targetType, node.NamespaceResolver, (IXmlLineInfo)node);
				propertyName = parts[1];
			}
			else
				throw new BuildException(Conversion, node, null, value, typeof(BindableProperty));

			if (typeName == null || propertyName == null)
				throw new BuildException(Conversion, node, null, value, typeof(BindableProperty));

			var typeRef = typeName.GetTypeReference(context.Cache, module, node);
			if (typeRef == null)
				throw new BuildException(TypeResolution, node, null, typeName);

			bpRef = GetBindablePropertyFieldReference(context.Cache, typeRef, propertyName, module);
			if (bpRef == null)
				throw new BuildException(PropertyResolution, node, null, propertyName, typeRef.Name);
			return bpRef;

			static XmlType GetTargetTypeName(INode node)
			{
				var targetType = ((node as ElementNode).Properties[new XmlName("", "TargetType")] as ValueNode)?.Value as string;
				return TypeArgumentsParser.ParseSingle(targetType, node.NamespaceResolver, (IXmlLineInfo)node);
			}
		}

		static XmlType FindTypeNameForVisualState(ElementNode parent, IXmlLineInfo lineInfo, ILContext context)
		{
			//1. parent is VisualState, don't check that

			//2. check that the VS is in a VSG
			// if (!(parent.Parent is IElementNode target) || target.XmlType.NamespaceUri != XamlParser.MauiUri || target.XmlType.Name != nameof(VisualStateGroup))
			if (parent.Parent is not ElementNode target || !target.XmlType.IsOfAnyType(nameof(VisualStateGroup)))
				throw new XamlParseException($"Expected {nameof(VisualStateGroup)} but found {parent.Parent}", lineInfo);

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Confirm the exact BindableProperty field name on the type (it must end in 'Property' and be public static).
  2. If the member is not a BindableProperty, either add one or reference an existing one.
  3. Check that the field is visible (public) and on the type you named (or an ancestor reachable by the resolver).

Example fix

<!-- before -->
<Setter Property="local:MyView.SpacingProperty" Value="10" />
<!-- field is actually named 'GapProperty' -->

<!-- after -->
<Setter Property="local:MyView.GapProperty" Value="10" />
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: The property name given does not correspond to a public static BindableProperty field on the resolved type — typo, not a BindableProperty, defined on a different type, or the field is non-public/non-static.

Common situations: Misspelling the property name; binding to a plain CLR property that is not backed by a BindableProperty; property declared on a base type but referenced on a derived name; field marked internal.

Related errors


AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13). Data as JSON: /api/errors/e464c1a717e16417. Report an issue: GitHub.