unoplatform/uno · error · Exception
Unable to find the type {typeName} in key {resource.Key}
Error message
Unable to find the type {typeName} in key {resource.Key} What it means
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.
Source
Thrown at src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs:858
const string usingPattern = "[using:";
if (propertyPath.StartsWith(usingPattern, StringComparison.Ordinal))
{
var lastDotIndex = propertyPath.LastIndexOf('.');
var propertyName = propertyPath.Substring(lastDotIndex + 1);
var typeName = propertyPath
.Substring(usingPattern.Length, lastDotIndex - usingPattern.Length)
.Replace("]", ".");
if (_metadataHelper.FindTypeByFullName(typeName) is INamedTypeSymbol typeSymbol)
{
yield return (typeSymbol, propertyName);
}
else
{
throw new Exception($"Unable to find the type {typeName} in key {resource.Key}");
}
}
}
}
}
}
View on GitHub (pinned to 0418340488)
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.
Example fix
<!-- before --> <ResourceDictionary> <x:String x:Key="using:MyApp.OldNs.MyType.MyProp">Value</x:String> </ResourceDictionary> <!-- after --> <ResourceDictionary> <x:String x:Key="using:MyApp.NewNs.MyType.MyProp">Value</x:String> </ResourceDictionary>
Defensive patterns
Strategy: validation
Validate before calling
// Verify the type in a 'using:Namespace.Type.Property' resource key resolves:
// var typeName = "MyApp.Models.MyType";
// var type = Type.GetType(typeName + ", MyApp.Models");
// if (type == null) Console.WriteLine($"Type {typeName} not found — check resource key"); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The type '{fullyQualifiedMetadataName}' is not found.
- Unable to resolve {symbol} (Reason: {errorTypeSymbol.Candida
- No valid setter found for attached property {name}
- Unable to find type {fullName}
- The type {0} could not be found
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/b5aaf825d176d5b9.
Report an issue: GitHub.