{"record":{"id":"5c8ecdd5541ec25a","repo":"unoplatform/uno","slug":"the-type-0-could-not-be-found","errorCode":null,"errorMessage":"The type {0} could not be found","messagePattern":"The type (.+?) could not be found","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs","lineNumber":675,"sourceCode":"\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (_metadataHelper.FindTypeByFullName($\"{GetTrimmedNamespace(@namespace.Namespace)}.{name.Substring(indexOfColon + 1)}\") is INamedTypeSymbol namedType)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn namedType;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\txmlnsContextProvider = xmlnsContextProvider.Owner;\n\t\t\t}\n\n\t\t\treturn _findType!(name);\n\t\t}\n\t\tprivate INamedTypeSymbol GetType(string name, XamlObjectDefinition? objectDefinition = null) =>\n\t\t\tResolveType(name, objectDefinition) ??\n\t\t\tthrow new InvalidOperationException(\"The type {0} could not be found\".InvariantCultureFormat(name));\n\n\t\tprivate INamedTypeSymbol GetType(XamlType type)\n\t\t{\n\t\t\tvar clrType = FindType(type);\n\n\t\t\tif (clrType == null)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException(\"The type {0} could not be found\".InvariantCultureFormat(type));\n\t\t\t}\n\n\t\t\treturn clrType;\n\t\t}\n\n\t\tprivate INamedTypeSymbol? SourceFindType(string name)\n\t\t{\n\t\t\tif (name.StartsWith(GlobalPrefix, StringComparison.Ordinal))\n\t\t\t{\n\t\t\t\treturn _metadataHelper.FindTypeByFullName(name.Substring(GlobalPrefix.Length)) as INamedTypeSymbol;","sourceCodeStart":657,"sourceCodeEnd":693,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs#L657-L693","documentation":"Thrown by GetType(string name, XamlObjectDefinition) when ResolveType returns null for a type name referenced in XAML. The error is formatted with the unresolved name. This covers the string-name overload of the type lookup.","triggerScenarios":"A XAML element or attribute references a type by name that cannot be resolved to any INamedTypeSymbol in the compilation — e.g. a missing xmlns prefix, an unregistered custom control, or a type from an unreferenced assembly.","commonSituations":"Custom control namespace not declared in xmlns; the assembly containing the type is not referenced by the project; type name typo; using a type from a NuGet package that was not restored or is the wrong version.","solutions":["Add the correct xmlns declaration mapping the prefix to the CLR namespace and assembly.","Ensure the project references the assembly containing the type.","Check for typos in the type name.","Run dotnet restore if the package may not be fully restored."],"exampleFix":"<!-- before (missing xmlns) -->\n<Page>\n  <my:CustomControl />\n</Page>\n<!-- after -->\n<Page xmlns:my=\"using:MyApp.Controls\">\n  <my:CustomControl />\n</Page>","handlingStrategy":"validation","validationCode":"<!-- Ensure xmlns declarations cover all referenced types -->\n<!-- Check: -->\n<!--   1. Every prefix used in XAML has a matching xmlns declaration -->\n<!--   2. The 'using:' or 'clr-namespace:' points to the correct namespace -->\n<!--   3. The assembly is referenced by the project -->","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare all xmlns prefixes at the root element.","Verify the project references the assembly containing custom types.","Run dotnet restore after adding new package references."],"tags":["type-resolution","xaml","source-generator","xmlns"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}