unoplatform/uno · error · Exception

Expected attached property path to be member access.

Error message

Expected attached property path to be member access.

What it means

Thrown by the x:Bind path parser when processing attached property syntax 'Element.(Owner.Property)'. After consuming '.(' and recursively parsing the inner path, the parser expects the result to be an XBindMemberAccess node (i.e. 'Owner.Property' form). If it is anything else — a bare identifier, a literal, or a nested expression — this exception fires.

Source

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

			else
			{
				path = ParseXBindIdentifier();
			}

			while (true)
			{
				if (Current == '.')
				{
					_position++;
					if (Current == '(')
					{
						_position++;

						var attachedPropertyPath = ParseXBindPath();

						if (attachedPropertyPath is not XBindMemberAccess memberAccess)
						{
							throw new Exception("Expected attached property path to be member access.");
						}

						if (Current != ')')
						{
							throw new Exception("Expected ')' in attached property syntax.");
						}

						path = new XBindAttachedPropertyAccess() { Member = path, PropertyClass = memberAccess.Path, PropertyName = memberAccess.Identifier };

						_position++;
					}
					else
					{
						path = new XBindMemberAccess() { Path = path, Identifier = ParseXBindIdentifier() };
					}
				}
				else if (Current == '[')
				{

View on GitHub (pinned to 0418340488)

Solutions

  1. Ensure the content inside '.(...)' is exactly 'ClassName.PropertyName' — two identifiers joined by a single dot.
  2. Remove extra dots, sub-paths, or non-identifier tokens from inside the parentheses.
  3. If you do not need an attached property, remove the '.(' syntax and use plain member access.

Example fix

<!-- before -->
<Text Text="{x:Bind MyElement.(Canvas.Left)}" />  <!-- valid -->
<Text Text="{x:Bind MyElement.(Left)}" />          <!-- throws [281] -->
<!-- after -->
<Text Text="{x:Bind MyElement.(Canvas.Left)}" />
Defensive patterns

Strategy: validation

Validate before calling

// Validate that attached-property x:Bind paths follow Element.(Class.Property):
// The inner parenthesized content must be exactly two identifiers joined by one dot.
// Regex check (for a linting tool):
//   \{x:Bind\s+\w+\.\(([A-Za-z_]\w*)\.([A-Za-z_]\w*)\)

Prevention

When it happens

Trigger: Writing {x:Bind Element.(Something)} where 'Something' is a single identifier rather than 'Owner.Property'; or {x:Bind Element.(Owner.Property.SubProp)} where the inner parse yields a chain instead of a simple member access node.

Common situations: Misunderstanding the attached-property path syntax in x:Bind; omitting the class qualifier inside the parentheses; trying to use a property-chain or method call where only 'Class.Property' is accepted.

Related errors


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