unoplatform/uno · error · Exception
Invalid identifier character {Current}
Error message
Invalid identifier character {Current} What it means
Thrown by ParseXBindIdentifier when the very first character of an expected identifier is not a valid identifier character (letter, digit, or underscore). The parser calls TryEatValidIdentifier, which returns false if no letter/digit/underscore was consumed at all.
Source
Thrown at src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/Utils/XBindExpressionParser.CoreParser.cs:231
path = new XBindIndexerAccess() { Path = path, Index = _xBind.Substring(currentPosition, _position - currentPosition) };
_position++;
}
else
{
break;
}
}
return path;
}
private XBindIdentifier ParseXBindIdentifier()
{
var identifierStart = _position;
if (!TryEatValidIdentifier())
{
throw new Exception($"Invalid identifier character {Current}");
}
if (Current == ':' && LookAhead == ':')
{
_position += 2;
if (!TryEatValidIdentifier())
{
throw new Exception($"Invalid identifier character {Current}");
}
}
return new XBindIdentifier() { IdentifierText = _xBind.Substring(identifierStart, _position - identifierStart) };
}
private bool TryEatValidIdentifier()
{
var foundValid = false;View on GitHub (pinned to 0418340488)
Solutions
- Inspect the x:Bind path at the reported position and replace the invalid character with a valid identifier.
- If you intended an operator or expression, rewrite the binding using a function or a property that returns the computed value.
- Remove any stray non-identifier characters from the path.
Example fix
<!-- before -->
<Text Text="{x:Bind @Name}" />
<!-- after -->
<Text Text="{x:Bind Name}" /> Defensive patterns
Strategy: validation
Validate before calling
// Validate x:Bind path identifiers start with a letter, digit, or underscore: // Linting check: identifier boundaries in x:Bind should not start with symbols like @, +, -, etc.
Prevention
- Avoid arithmetic operators and unsupported symbols in x:Bind paths.
- If you need computation, expose a property on the ViewModel.
- Review x:Bind expressions for stray characters after copy-paste.
When it happens
Trigger: An x:Bind path contains a character that starts an identifier but is invalid — e.g. a symbol like '+', '-', '@', or a parenthesis/dot in a position where the parser expects an identifier name.
Common situations: Expression-style x:Bind that the parser does not support (e.g. arithmetic operators); a malformed path after a '.' or at the start of the binding; stray markup characters copied into the binding string.
Related errors
- Missing parenthesis?
- Expected attached property path to be member access.
- Expected ')' in attached property syntax.
- x:Bind indexing expects a single literal argument
- Only properties and fields can be indexed.
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/aa767f41c22256a8.
Report an issue: GitHub.