dotnet/maui · error · BuildException

XC0000

XC0000

Error message

Cannot resolve type "{0}".

What it means

XamlC error XC0000 (general type resolution). After parsing the type name from the value or from a Style TargetType, the converter calls GetTypeReference; if the named type cannot be resolved against loaded assemblies, it throws XC0000.

Source

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

					typeName = GetTargetTypeName(node.Parent);
				}
				propertyName = parts[0];
			}
			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

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Declare or correct the xmlns prefix pointing at the type's CLR namespace and assembly.
  2. Verify the type name spelling and namespace exactly match the declaring type.
  3. Add the missing project/assembly reference that contains the type.

Example fix

<!-- before -->
<Setter Property="MyView.SpacingProperty" Value="10" />
<!-- 'MyView' is unresolved -->

<!-- after -->
xmlns:local="clr-namespace:MyLib.Controls;assembly=MyLib"
<Setter Property="local:MyView.SpacingProperty" Value="10" />
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: The type referenced in the BindableProperty value (or the TargetType that feeds it) does not resolve: wrong name, missing xmlns prefix declaration, or the declaring assembly is not referenced.

Common situations: Forgot to declare xmlns:local/xmlns:custom; typo in the type name; type lives in a project/assembly not referenced by the app; namespace changed after a rename.

Related errors


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