unoplatform/uno · error · FormatException
Invalid type name list: '{0}'
Error message
Invalid type name list: '{0}' What it means
Thrown by XamlTypeName.ParseList when TryParseList returns false. ParseList is the throwing wrapper; the FormatException signals the comma-separated type-name list is malformed or contains a name that fails to parse (bad prefix, unknown namespace, mismatched brackets).
Source
Thrown at src/SourceGenerators/System.Xaml/System.Xaml.Schema/XamlTypeName.cs:105
local = typeName.Substring (idx + 1);
if (!XamlLanguage.IsValidXamlName (prefix))
return false;
}
if (!XamlLanguage.IsValidXamlName (local))
return false;
string ns = namespaceResolver.GetNamespace (prefix);
if (ns == null)
return false;
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> ();View on GitHub (pinned to 0418340488)
Solutions
- Use TryParseList instead of ParseList and handle the false return with detail about which element failed.
- Ensure every prefix used across all list elements is mapped in the resolver.
- Validate list syntax: comma-separated `prefix:Name(args)` entries with balanced parentheses.
- Parse elements individually to isolate which one is malformed.
Example fix
// before
var list = XamlTypeName.ParseList(input, resolver);
// after
if (!XamlTypeName.TryParseList(input, resolver, out var list)) {
throw new FormatException($"Cannot parse XAML type name list '{input}'; verify each element's prefix and namespace.");
} Defensive patterns
Strategy: try-catch
Try / catch
try {
var list = XamlTypeName.ParseList(input, resolver);
} catch (FormatException ex) {
// parse elements individually to isolate which one is malformed
} Prevention
- Prefer TryParseList over ParseList.
- Ensure every prefix across all list elements is mapped in the resolver.
- Validate list syntax (comma-separated, balanced parentheses) before parsing.
When it happens
Trigger: Calling XamlTypeName.ParseList("ns:Foo, x:Int32", resolver) where one element fails to parse; unbalanced parentheses in a generic argument list spanning the comma; a list element with an unmapped prefix.
Common situations: Parsing multi-type generic argument lists built by hand; lists assembled from user input with inconsistent prefixes; resolver missing one of the prefixes used across the list.
Related errors
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/a687a4ff03956f1e.
Report an issue: GitHub.