dotnet/maui · error · BuildException

XC0001

XC0001

Error message

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

What it means

Thrown by GetPropertyValue when neither a BindableProperty getter nor a public instance get-property named localName can be resolved on the parent type. The compiler cannot read the property to get or bind it.

Source

Thrown at src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs:1405

			throw new BuildException(MemberResolution, iXmlLineInfo, null, localName);
		}

		public static IEnumerable<Instruction> GetPropertyValue(VariableDefinition parent, XmlName propertyName, ILContext context, IXmlLineInfo lineInfo, out TypeReference propertyType)
		{
			var module = context.Body.Method.Module;
			var localName = propertyName.LocalName;
			var bpRef = GetBindablePropertyReference(parent, propertyName.NamespaceURI, ref localName, out var attached, context, lineInfo);

			//If it's a BP, GetValue ()
			if (CanGetValue(parent, bpRef, attached, lineInfo, context, out _))
				return GetValue(parent, bpRef, lineInfo, context, out propertyType);

			//If it's a property, get it
			if (CanGet(parent, localName, context, out _))
				return Get(parent, localName, lineInfo, context, out propertyType);

			throw new BuildException(PropertyResolution, lineInfo, null, localName, parent.VariableType.FullName);
		}

		static FieldReference GetBindablePropertyReference(VariableDefinition parent, string namespaceURI, ref string localName, out bool attached, ILContext context, IXmlLineInfo iXmlLineInfo)
			=> GetBindablePropertyReference(parent.VariableType, namespaceURI, ref localName, out attached, context, iXmlLineInfo);

		public static FieldReference GetBindablePropertyReference(TypeReference bpOwnerType, string namespaceURI, ref string localName, out bool attached, ILContext context, IXmlLineInfo iXmlLineInfo)
		{
			var module = context.Body.Method.Module;

			//If it's an attached BP, update elementType and propertyName
			attached = GetNameAndTypeRef(ref bpOwnerType, namespaceURI, ref localName, context, iXmlLineInfo);
			var name = $"{localName}Property";
			FieldDefinition bpDef = bpOwnerType.GetField(context.Cache,
														fd => fd.Name == name &&
														fd.IsStatic &&
														(fd.IsPublic || fd.IsAssembly), out TypeReference declaringTypeReference);
			if (bpDef == null)
				return null;

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Ensure a public, non-static, gettable property (or BindableProperty) with that exact name exists on the type.
  2. Rebuild referencing the assembly that defines the property.
  3. Check for typos and namespace/type-resolution issues on the parent element.

Example fix

// before (private / no getter)
public string Title { private get; set; }

// after
public string Title { get; set; }
Defensive patterns

Strategy: validation

Validate before calling

// Property must have a public, non-static getter (or be a BindableProperty)
static bool IsXamlReadable(Type owner, string name)
{
    var p = owner.GetProperty(name);
    return p != null && p.GetMethod != null && p.GetMethod.IsPublic && !p.GetMethod.IsStatic;
}

Prevention

When it happens

Trigger: Reading a property (e.g. in a binding or GetPropertyValue) that does not exist on the type, has no public non-static getter, or is not a BindableProperty.

Common situations: Binding to a property that was renamed/removed; property is private, write-only, or static; wrong type resolved for the parent.

Related errors


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