{"record":{"id":"b5aaf825d176d5b9","repo":"unoplatform/uno","slug":"unable-to-find-the-type-typename-in-key-resourc","errorCode":null,"errorMessage":"Unable to find the type {typeName} in key {resource.Key}","messagePattern":"Unable to find the type (.+?) in key (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs","lineNumber":858,"sourceCode":"\n\t\t\t\tconst string usingPattern = \"[using:\";\n\n\t\t\t\tif (propertyPath.StartsWith(usingPattern, StringComparison.Ordinal))\n\t\t\t\t{\n\t\t\t\t\tvar lastDotIndex = propertyPath.LastIndexOf('.');\n\n\t\t\t\t\tvar propertyName = propertyPath.Substring(lastDotIndex + 1);\n\t\t\t\t\tvar typeName = propertyPath\n\t\t\t\t\t\t.Substring(usingPattern.Length, lastDotIndex - usingPattern.Length)\n\t\t\t\t\t\t.Replace(\"]\", \".\");\n\n\t\t\t\t\tif (_metadataHelper.FindTypeByFullName(typeName) is INamedTypeSymbol typeSymbol)\n\t\t\t\t\t{\n\t\t\t\t\t\tyield return (typeSymbol, propertyName);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new Exception($\"Unable to find the type {typeName} in key {resource.Key}\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","sourceCodeStart":840,"sourceCodeEnd":865,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs#L840-L865","documentation":"Thrown when parsing a resource key that uses the 'using:Namespace.Type.Property' pattern. The type portion is extracted and looked up via FindTypeByFullName; if the type cannot be found, the exception includes both the type name and the resource key.","triggerScenarios":"A resource dictionary entry uses a key like 'using:MyApp.Models.MyType.MyProperty' where 'MyApp.Models.MyType' does not resolve to a known type in the compilation.","commonSituations":"The type namespace was renamed or the type was moved; the assembly containing the type is not referenced; typo in the namespace or type name in the resource key; the 'using:' pattern was applied to a non-static-property scenario incorrectly.","solutions":["Verify the fully-qualified type name in the 'using:' key matches a real type.","Ensure the assembly containing the type is referenced by the project.","Check for namespace changes after refactoring and update the key accordingly."],"exampleFix":"<!-- before -->\n<ResourceDictionary>\n  <x:String x:Key=\"using:MyApp.OldNs.MyType.MyProp\">Value</x:String>\n</ResourceDictionary>\n<!-- after -->\n<ResourceDictionary>\n  <x:String x:Key=\"using:MyApp.NewNs.MyType.MyProp\">Value</x:String>\n</ResourceDictionary>","handlingStrategy":"validation","validationCode":"// Verify the type in a 'using:Namespace.Type.Property' resource key resolves:\n// var typeName = \"MyApp.Models.MyType\";\n// var type = Type.GetType(typeName + \", MyApp.Models\");\n// if (type == null) Console.WriteLine($\"Type {typeName} not found — check resource key\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the fully-qualified type name in 'using:' resource keys.","Update resource keys after moving types to new namespaces.","Ensure the type's assembly is referenced by the project."],"tags":["type-resolution","xaml","source-generator","resource-dictionary"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}