AvaloniaUI/Avalonia · error · ExpressionParseException
Expected ' '.
Error message
Expected '{close}'. What it means
ArgumentListParser.ParseArguments throws ExpressionParseException("Expected '{close}'.") at line 47 when the read loop exits (reader exhausted) without ever consuming the close bracket. The argument list started correctly but was never closed before end of input.
Solutions
- Close the indexer with the matching `]` after the last argument.
- When assembling paths programmatically, always append the close bracket.
Example fix
// before
{Binding Matrix[0,1}
// after
{Binding Matrix[0,1]} Defensive patterns
Strategy: try-catch
Validate before calling
// Same terminated check as [175]: ensure the close bracket exists for multi-arg indexers.
static bool IndexerIsTerminated(string path)
{
int open = path.IndexOf('[');
if (open < 0) return true;
return path.IndexOf(']', open) >= 0;
}
if (!IndexerIsTerminated(path)) throw new ArgumentException("Unterminated indexer."); Try / catch
try { var nodes = BindingExpressionGrammar.Parse(path); }
catch (ExpressionParseException ex) when (ex.Message.Contains("Expected"))
{ /* add the missing ']' */ } Prevention
- Close every indexer with ']', especially multi-argument ones.
- Validate dynamically built paths end with ']'.
- Lint binding paths in tests.
When it happens
Trigger: An indexer argument list spanning multiple arguments that runs off the end of the string without a closing bracket, e.g. `Items[0,1`.
Common situations: Truncated multi-argument indexer paths; dynamic path building that omits the final bracket; XAML truncation.
Related errors
- Expected ' '.
- Expected indexer argument.
- Expected end of expression.
- Expected ' '.
- Could not convert list index
AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13).
Data as JSON: /api/errors/8dde692612306bc9.
Report an issue: GitHub.
Appendix: source
Thrown at src/Avalonia.Base/Data/Core/Parsers/ArgumentListParser.cs:47
{
throw new ExpressionParseException(r.Position, $"Expected '{delimiter}'.");
}
else if (r.TakeIf(close))
{
return result;
}
else
{
if (r.Take() != delimiter)
{
throw new ExpressionParseException(r.Position, $"Expected '{delimiter}'.");
}
r.SkipWhitespace();
}
}
throw new ExpressionParseException(r.Position, $"Expected '{close}'.");
}
throw new ExpressionParseException(r.Position, $"Expected '{open}'.");
}
}
}
View on GitHub (pinned to 11c5427268)