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
- Null-check the input before calling TryParseList and treat null as an empty list in your flow.
- Default the variable to string.Empty and let the parser produce an empty/single result.
- 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
- Null-check the list string before parsing.
- Default optional list inputs to string.Empty rather than null.
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.