unoplatform/uno · error · Exception

Expected digits after floating point.

Error message

Expected digits after floating point.

What it means

When parsing a numeric literal argument in x:Bind, a '.' is treated as the start of a fractional part and must be followed by at least one digit. A '.' with no following digit (e.g. '3.') throws. Example trigger: {x:Bind Foo(3.)}.

Solutions

  1. Provide at least one digit after the '.', e.g. 3.0 instead of 3.
  2. Drop the '.' if an integer was intended.

Example fix

<!-- before -->
<TextBlock Text="{x:Bind Scale(3.)}" />
<!-- after -->
<TextBlock Text="{x:Bind Scale(3.0)}" />
Defensive patterns

Strategy: validation

Validate before calling

// Lint rule: a '.' inside a numeric x:Bind argument must be followed by a digit.
static bool FractionWellFormed(string num)
{ int i = num.IndexOf('.'); return i < 0 || (i + 1 < num.Length && char.IsDigit(num[i + 1])); }

Prevention

When it happens

Trigger: A numeric x:Bind argument ends in '.' with no fractional digits, e.g. {x:Bind Foo(3.)} or {x:Bind Foo(.5)} when the integer portion is absent is handled separately, but '3.' specifically triggers this.

Common situations: Typo in a numeric x:Bind literal; trailing decimal point.

Related errors


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

Appendix: source

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

				var literal = _xBind.Substring(oldPosition, ++_position - oldPosition);
				return new XBindLiteralArgument() { LiteralArgument = literal };
			}
			else if (char.IsDigit(Current))
			{
				// literal numeric argument
				var oldPosition = _position;
				while (char.IsDigit(Current))
				{
					_position++;
				}

				if (Current == '.')
				{
					_position++;
					if (!char.IsDigit(Current))
					{
						throw new Exception("Expected digits after floating point.");
					}

					while (char.IsDigit(Current))
					{
						_position++;
					}
				}

				var literal = _xBind.Substring(oldPosition, _position - oldPosition);
				return new XBindLiteralArgument() { LiteralArgument = literal };
			}

			return new XBindPathArgument() { Path = ParseXBindPath() };
		}

		private void SkipWhitespaces()
		{
			while (char.IsWhiteSpace(Current))

View on GitHub (pinned to 0418340488)