{"record":{"id":"b086f7d9cc2aeb48","repo":"dotnet/maui","slug":"xc0000-b086f7","errorCode":"XC0000","errorMessage":"Cannot resolve type \"{0}\".","messagePattern":"Cannot resolve type \"(.+?)\"\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/XmlTypeExtensions.cs","lineNumber":143,"sourceCode":"\t\t\tif (types.Distinct(TypeRefComparer.Default).Skip(1).Any())\n\t\t\t{\n\t\t\t\ttypeReference = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar type = types.Distinct(TypeRefComparer.Default).FirstOrDefault();\n\t\t\tif (type != null && typeArguments != null && type.HasGenericParameters)\n\t\t\t\ttype = module.ImportReference(type).MakeGenericInstanceType(typeArguments.Select(x => x.GetTypeReference(cache, module, xmlInfo)).ToArray());\n\n\t\t\treturn (typeReference = (type == null) ? null : module.ImportReference(type)) != null;\n\t\t}\n\n\t\tpublic static TypeReference GetTypeReference(this XmlType xmlType, XamlCache cache, ModuleDefinition module, IXmlLineInfo xmlInfo, bool expandToExtension = true)\n\t\t{\n\t\t\tif (TryGetTypeReference(xmlType, cache, module, xmlInfo, expandToExtension: expandToExtension, out TypeReference typeReference))\n\t\t\t\treturn typeReference;\n\n\t\t\tthrow new BuildException(BuildExceptionCode.TypeResolution, xmlInfo, null, $\"{xmlType.NamespaceUri}:{xmlType.Name}\");\n\t\t}\n\n\t\tstatic XmlnsDefinitionAttribute GetXmlnsDefinition(this CustomAttribute ca, AssemblyDefinition asmDef)\n\t\t{\n\t\t\tvar attr = new XmlnsDefinitionAttribute(\n\t\t\t\t\t\t\tca.ConstructorArguments[0].Value as string,\n\t\t\t\t\t\t\tca.ConstructorArguments[1].Value as string);\n\n\t\t\tstring assemblyName = null;\n\t\t\tif (ca.Properties.Count > 0)\n\t\t\t\tassemblyName = ca.Properties[0].Argument.Value as string;\n\t\t\tattr.AssemblyName = assemblyName ?? asmDef.Name.FullName;\n\t\t\treturn attr;\n\t\t}\n\n\t\tpublic static IList<XmlnsPrefixAttribute> GetXmlnsPrefixAttributes(ModuleDefinition module)\n\t\t{\n\t\t\tvar xmlnsPrefixes = new List<XmlnsPrefixAttribute>();","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/XmlTypeExtensions.cs#L125-L161","documentation":"Raised when a type referenced in XAML cannot be resolved to any CLR type after consulting all XmlnsDefinitionAttribute mappings. TryGetTypeReference returns false (no matching type) and GetTypeReference throws BuildException(TypeResolution) with the unresolved 'namespace:name' string.","triggerScenarios":"TryGetTypeReference finds zero candidate types for the XmlType (types.Distinct(...).FirstOrDefault() is null), so the public GetTypeReference throws BuildException(BuildExceptionCode.TypeResolution, ...) with '{NamespaceUri}:{Name}'.","commonSituations":"Missing xmlns declaration for a custom control; a clr-namespace that points at the wrong namespace or assembly; the referenced assembly is not referenced by the project or was renamed; case mismatch in namespace or type name.","solutions":["Add or fix the xmlns declaration, e.g. xmlns:local='clr-namespace:MyApp.Views;assembly=MyApp'.","Confirm the assembly containing the type is referenced by the project and that its name/namespace match the clr-namespace string exactly (case-sensitive).","If using a custom xmlns uri, ensure the providing assembly has the matching XmlnsDefinitionAttribute and is included in the build."],"exampleFix":"<!-- before -->\n<local:MyView xmlns:local=\"clr-namespace:WrongNamespace;assembly=MyApp\" />\n<!-- after -->\n<local:MyView xmlns:local=\"clr-namespace:MyApp.Views;assembly=MyApp\" />","handlingStrategy":"validation","validationCode":"// At design time, confirm the clr-namespace and assembly referenced in xmlns exist.\n// Example: xmlns:local=\"clr-namespace:MyApp.Views;assembly=MyApp\"\n// -> assert typeof(MyApp.Views.SomeType).Assembly.GetName().Name == \"MyApp\".","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep xmlns clr-namespace strings in sync with the actual namespace and assembly name (case-sensitive).","Add the assembly/project reference that owns the type to every head project that uses the XAML.","Use a custom xmlns uri backed by XmlnsDefinitionAttribute for shared libraries."],"tags":["xaml","type-resolution","build-task","missing-assembly","xc0000"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}