unoplatform/uno · error · ArgumentNullException

typeNameList

Error message

typeNameList

What it means

Thrown by XamlTypeName.TryParseList when the `typeNameList` argument is null. The list parser tokenizes the input string by comma/paren, so a null string cannot be tokenized; it is rejected immediately rather than returning false.

Source

Thrown at src/SourceGenerators/System.Xaml/System.Xaml.Schema/XamlTypeName.cs:114

			result = new XamlTypeName (ns, local, args);
			return true;
		}

		public static IList<XamlTypeName> ParseList (string typeNameList, IXamlNamespaceResolver namespaceResolver)
		{
			IList<XamlTypeName> list;
			if (!TryParseList (typeNameList, namespaceResolver, out list))
				throw new FormatException (String.Format (CultureInfo.InvariantCulture, "Invalid type name list: '{0}'", typeNameList));
			return list;
		}

		static readonly char [] comma_or_parens = new char [] {',', '(', ')'};

		public static bool TryParseList (string typeNameList, IXamlNamespaceResolver namespaceResolver, out IList<XamlTypeName> result)
		{
			if (typeNameList == null)
				throw new ArgumentNullException ("typeNameList");
			if (namespaceResolver == null)
				throw new ArgumentNullException ("namespaceResolver");

			result = null;
			int idx = 0;
			int parens = 0;
			XamlTypeName tn;

			List<string> l = new List<string> ();
			int lastToken = 0;
			while (true) {
				int i = typeNameList.IndexOfAny (comma_or_parens, idx);
				if (i < 0) {
					l.Add (typeNameList.Substring (lastToken));
					break;
				}
				
				switch (typeNameList [i]) {

View on GitHub (pinned to 0418340488)

Solutions

  1. Null-check the input before calling TryParseList and treat null as an empty list in your flow.
  2. Default the variable to string.Empty and let the parser produce an empty/single result.
  3. Validate upstream sources of the list string for null.

Example fix

// before
XamlTypeName.TryParseList(listStr, resolver, out var list);

// after
if (listStr == null) { list = new List<XamlTypeName>(); return; }
XamlTypeName.TryParseList(listStr, resolver, out list);
Defensive patterns

Strategy: validation

Validate before calling

// before TryParseList
if (typeNameList == null) { result = new List<XamlTypeName>(); return; }

Prevention

When it happens

Trigger: Calling XamlTypeName.TryParseList(null, resolver, out _); passing a null list string sourced from an absent attribute or an uninitialized variable.

Common situations: Optional config that omits a type-name list (null); deserialization feeding null into list parsing; refactors dropping the string.

Related errors


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