unoplatform/uno · error · InvalidOperationException

Unable to find type {fullName}

Error message

Unable to find type {fullName}

What it means

GetTypeByFullName wraps FindTypeByFullName and throws InvalidOperationException if the lookup returns null — i.e. no type with that fully-qualified name exists in any referenced assembly of the compilation.

Source

Thrown at src/SourceGenerators/Uno.UI.SourceGenerators/RoslynMetadataHelper.cs:142

				var setMethod = type?.GetFirstMethodWithName("Set" + name);
				if (setMethod?.FindDependencyPropertyType() is { } propertyType)
				{
					return propertyType;
				}

				type = type?.BaseType;
			}

			throw new InvalidOperationException($"No valid setter found for attached property {name}");
		}

		public ITypeSymbol GetTypeByFullName(string fullName)
		{
			var symbol = FindTypeByFullName(fullName);

			if (symbol == null)
			{
				throw new InvalidOperationException($"Unable to find type {fullName}");
			}

			return symbol;
		}

		public bool IsTypeImplemented(INamedTypeSymbol type) => _isTypeImplemented(type);

		private static bool SourceIsTypeImplemented(INamedTypeSymbol type)
			=> type.GetAttributes().None(a => a.AttributeClass?.GetFullyQualifiedTypeExcludingGlobal() == XamlConstants.Types.NotImplementedAttribute);

		public ISymbol? FindPropertyByOwnerSymbol(INamedTypeSymbol? type, string propertyName) => _findPropertyByOwnerSymbol!(type, propertyName);

		private ISymbol? SourceFindPropertyByOwnerSymbol(INamedTypeSymbol? type, string propertyName)
		{
			if (string.IsNullOrEmpty(propertyName))
			{
				return null;
			}

View on GitHub (pinned to 0418340488)

Solutions

  1. Add/restore the reference (PackageReference or ProjectReference) for the assembly declaring the type.
  2. Confirm the full name matches the current dependency version (namespace/type may have moved).
  3. Ensure the active TFM includes that assembly.

Example fix

<!-- before: Microsoft.UI.Xaml.Controls not referenced -->
<ItemGroup>
  <!-- reference missing -->
</ItemGroup>
<!-- after -->
<ItemGroup>
  <PackageReference Include="Microsoft.UI.Xaml" Version="..." />
</ItemGroup>
Defensive patterns

Strategy: validation

Validate before calling

// Confirm a type by full name is reachable in the compilation before building
if (Type.GetType(fullName) == null) Console.WriteLine($"WARN: {fullName} not resolvable; add its reference.");

Prevention

When it happens

Trigger: The generator requests a type by full name that is absent from the compilation because its assembly is not referenced or the name is stale.

Common situations: A XAML/code reference to a type whose PackageReference was removed; a namespace rename in a dependency; targeting a TFM that excludes the type's assembly.

Related errors


AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13). Data as JSON: /api/errors/ee2fa86596ecd719. Report an issue: GitHub.