unoplatform/uno · error · Exception

Expected ')' after parsing invocation arguments

Error message

Expected ')' after parsing invocation arguments

What it means

After parsing one or more comma-separated arguments in an x:Bind invocation, the parser requires a closing ')'. If the arguments are not terminated by ')', it throws. Example trigger: {x:Bind Foo(a, b}.

Source

Thrown at src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/Utils/XBindExpressionParser.CoreParser.cs:78

				{
					return new XBindInvocation() { Path = bindPath, Arguments = Array.Empty<XBindArgument>() };
				}

				throw new Exception("Expected end of expression after invocation.");
			}


			var arguments = new List<XBindArgument>();
			arguments.Add(ParseXBindArgument());
			while (Current == ',')
			{
				_position++;
				arguments.Add(ParseXBindArgument());
			}

			if (Current != ')')
			{
				throw new Exception("Expected ')' after parsing invocation arguments");
			}

			_position++;
			if (!IsDone)
			{
				throw new Exception("Expected end of expression after invocation.");
			}

			return new XBindInvocation() { Path = bindPath, Arguments = arguments.ToArray() };
		}

		private XBindArgument ParseXBindArgument()
		{
			SkipWhitespaces();
			if (Current == '"')
			{
				// literal string argument
				var oldPosition = _position++;

View on GitHub (pinned to 0418340488)

Solutions

  1. Add the missing ')' to close the invocation.
  2. Balance all parentheses in the x:Bind expression.

Example fix

<!-- before -->
<TextBlock Text="{x:Bind Concat(A, B}" />
<!-- after -->
<TextBlock Text="{x:Bind Concat(A, B)}" />
Defensive patterns

Strategy: validation

Validate before calling

// Lint rule: every '(' in an x:Bind invocation must have a matching ')'.
static bool BalancedParens(string expr) { int d = 0; foreach (var c in expr) { if (c == '(') d++; else if (c == ')') d--; if (d < 0) return false; } return d == 0; }

Prevention

When it happens

Trigger: An x:Bind invocation with unbalanced parentheses, e.g. {x:Bind Foo(a, b} or {x:Bind Foo(a}.

Common situations: Missing closing parenthesis in a hand-edited x:Bind method call.

Related errors


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