unoplatform/uno · error · ArgumentNullException

assemblyQualifiedTypeName

Error message

assemblyQualifiedTypeName

What it means

Thrown by XamlAccessLevel.PrivateAccessTo(string) when the assembly-qualified type name argument is null. The string is stored as the private-access target, so a null would create an unresolvable access level.

Source

Thrown at src/SourceGenerators/System.Xaml/System.Xaml.Permissions/XamlAccessLevel.cs:57

			}

			return new XamlAccessLevel (assembly.GetName ());
		}
		public static XamlAccessLevel AssemblyAccessTo (AssemblyName assemblyName)
		{
			if (assemblyName == null)
			{
				throw new ArgumentNullException ("assemblyName");
			}

			return new XamlAccessLevel (assemblyName);
		}

		public static XamlAccessLevel PrivateAccessTo (string assemblyQualifiedTypeName)
		{
			if (assemblyQualifiedTypeName == null)
			{
				throw new ArgumentNullException ("assemblyQualifiedTypeName");
			}

			return new XamlAccessLevel (assemblyQualifiedTypeName);
		}

		public static XamlAccessLevel PrivateAccessTo (Type type)
		{
			if (type == null)
			{
				throw new ArgumentNullException ("type");
			}

			return new XamlAccessLevel (type.AssemblyQualifiedName);
		}

		internal XamlAccessLevel (AssemblyName assemblyAccessToAssemblyName)
		{
			AssemblyAccessToAssemblyName = assemblyAccessToAssemblyName;

View on GitHub (pinned to 0418340488)

Solutions

  1. Pass a fully assembly-qualified type name string and verify it is non-null.
  2. Prefer PrivateAccessTo(Type) when you have the Type instance.
  3. Validate that Type.AssemblyQualifiedName is non-null before forwarding the string.

Example fix

// before
string n = someType.AssemblyQualifiedName; // null for open generic
var lvl = XamlAccessLevel.PrivateAccessTo(n); // throws

// after
var lvl = XamlAccessLevel.PrivateAccessTo(someType);
Defensive patterns

Strategy: validation

Validate before calling

string n = type.AssemblyQualifiedName;
if (n == null) throw new InvalidOperationException($"{type} has no AQN");
var lvl = XamlAccessLevel.PrivateAccessTo(n);

Type guard

static bool HasAssemblyQualifiedName(Type t)
    => t != null && t.AssemblyQualifiedName != null;

Prevention

When it happens

Trigger: Calling PrivateAccessTo with a null type-name string, e.g. from Type.AssemblyQualifiedName being null (possible for certain dynamic or generic types).

Common situations: Constructing access levels from types whose AssemblyQualifiedName is null (open generics, anonymous types in some runtimes); config-driven XAML loaders that read type names which can be unset.

Related errors


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