Skip to content

Allow dots inside indexers in compiled binding paths - #40724

Closed
kubaflo wants to merge 8 commits into
mainfrom
fix-28333-compiled-binding-indexer-dot
Closed

kubaflo wants to merge 8 commits into
mainfrom
fix-28333-compiled-binding-indexer-dot

Conversation

@kubaflo

@kubaflo kubaflo commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Target Branch

This PR is for Initial base
New features, API changes, or .NET 12 work (including .NET 12 fixes) main
.NET 11 servicing fixes net11, for review
Older servicing, release integration, infrastructure, or documentation The branch designated for that work

Description of Change

Compiled bindings (x:DataType) split the binding path on every ., including inside an indexer, so a dictionary key with a dot broke the path:

<Label x:DataType="local:ViewModel" Text="{Binding Items[he.llo]}" />

XamlC (SetPropertiesVisitor) and the XAML source generator (CompiledBindingMarkup) now split the path only on dots outside [...].

Issues Fixed

Fixes #28333

Let AI finish this PR

  • Let the MAUI agent address review feedback and fix remaining issues on this PR. Maintainers still decide whether it is merged. For PRs from forks, the agent opens a follow-up PR that keeps your commits.

Follow-up to #28333 for x:DataType bindings (XamlC and the XAML source generator).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo

kubaflo commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@dalexsoto stamp

Copilot AI balanced review requested due to automatic review settings November 27, 2026 14:00
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 27, 2026 14:01 — with GitHub Actions Inactive
@kubaflo

This comment has been minimized.

@github-actions

This comment has been minimized.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 27, 2026 14:01 — with GitHub Actions Inactive
@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it label Nov 27, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress label Nov 27, 2026
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 27, 2026 14:02 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 27, 2026 14:03 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 27, 2026 14:05 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 27, 2026 14:05 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

String-indexer paths containing a literal [ in the key can lose trailing properties in both compiled-binding implementations, producing incorrect bindings.

2 open issues
What changed in this PR

This PR addresses #28333 by allowing dotted dictionary keys, such as Items[he.llo], in .NET MAUI compiled bindings.

Changes:

  • Adds bracket-aware path splitting to the XAML source generator.
  • Applies the same approach to XamlC, replacing unconditional splitting on dots.
File Description
src/​Controls/​src/​SourceGen/​CompiledBindingMarkup.cs Updates source-generated bindings to preserve dots inside indexers.
src/​Controls/​src/​Build.Tasks/​SetPropertiesVisitor.cs Updates XamlC bindings to preserve dots inside indexers.

Review effort: Balanced

dalexsoto
dalexsoto previously approved these changes Nov 27, 2026

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamping as requested by @kubaflo; no code review performed.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 2 findings · ⚠️ 1 breaking change

Reviewed commit 263320e.

Warning

Existing apps would look or behave differently without opting in. See the Behavioral Change Disclosure findings at:

See inline comments for details.

@github-actions github-actions Bot added s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Nov 27, 2026
@github-actions github-actions Bot mentioned this pull request Nov 27, 2026
github-actions Bot and others added 2 commits November 27, 2026 14:40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 14:46
@github-actions github-actions Bot added s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress and removed s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Nov 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

XamlC still misparses indexer keys containing both a literal closing bracket and a dot, causing incorrect property lookup and requiring a parser fix with regression coverage.

1 open issue

Review effort: Balanced

@github-actions github-actions Bot added the s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) label Nov 27, 2026
github-actions Bot and others added 3 commits November 27, 2026 15:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 15:37
@github-actions github-actions Bot added s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress and removed s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Nov 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The indexer parser mistakes a literal [ within a key for another indexer, splitting valid paths incorrectly and causing XamlC property-lookup failures.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve literal brackets in XamlC indexer keys

src/​Controls/​src/​Xaml/​CompiledBindingPath.cs:26

The nextOpen cutoff treats a literal [ inside the current key as another indexer: Items[a]b[c.d].Length becomes Items[a]b[c, d], and Length. XamlC then extracts key a and fails property lookup for d] instead of using the complete key a]b[c.d. Distinguish a subsequent indexer segment from literal key text, and add this combined-bracket case to the XamlC fixture while retaining the chained-indexer regression test.

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 2 findings

Reviewed commit 0eb78bf.

See inline comments for details.

@github-actions github-actions Bot added s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Nov 27, 2026
github-actions Bot and others added 2 commits November 27, 2026 16:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 16:31
@github-actions github-actions Bot added s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress and removed s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Nov 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Shared parser and C# generation changes require XamlC/SourceGen regression-suite execution because standalone splitter checks cannot verify generated IL, bound values, or TwoWay setters.

No open issues 🎉

Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — No more findings

Reviewed commit 0d4ff1c.

@github-actions github-actions Bot added s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selected Tests

Result NOTHING TO RUN Platforms none Tests 0 UI, 0 device Commit 0d4ff1c2


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ➖ nothing to run none —
Device tests ➖ nothing to run none —
🧪 UI tests — nothing to run

ℹ️ The AI found no changes relevant to UI tests, so no maui-pr-uitests run was queued.

GPT-6.2 Sol: Skip UI tests because unit tests directly cover the compiled-binding indexer fix.
MAI Code 2: Compiled binding path parsing change for XamlC and source generation; no UI or device suites are needed because coverage is in unit tests.

🧪 Running — nothing

No UI tests run for this PR.

🧪 Device tests — nothing to run

ℹ️ The AI found no changes relevant to device tests, so no maui-pr-devicetests run was queued.

GPT-6.2 Sol: Skip device tests because the modified compiled-binding paths are covered without a device.
MAI Code 2: Compiled binding path parsing and unit-test-only changes require no device tests.

🧪 Running — nothing

No device tests run for this PR.

⏭️ Skipped — what neither suite runs

UI tests — 77 categories, 4 platforms

Platforms not run: Android, iOS, MacCatalyst, Windows

Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.

Device tests — 105 categories, 4 platforms

Platforms not run: Android, iOS, MacCatalyst, Windows

Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.

🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)

UI tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android — —
iOS — —
MacCatalyst — —
Windows — —

GPT-6.2 Sol — Skip UI tests because unit tests directly cover the compiled-binding indexer fix.

  • XamlC and the source generators change indexer parsing and literal escaping; unit tests cover both.
  • No UI fixtures, native controls, or default UI build settings changed.

MAI Code 2 — Compiled binding path parsing change for XamlC and source generation; no UI or device suites are needed because coverage is in unit tests.

  • Changes are confined to XAML/compiled binding parsing and generated-string escaping.
  • Added XAML and BindingSourceGen unit tests cover dotted and bracketed indexer keys for both inflators.
  • No control handlers, platform behavior, runtime layout, or device-specific code is changed; UI and device suites would not add relevant coverage.

Device tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android — —
iOS — —
MacCatalyst — —
Windows — —

GPT-6.2 Sol — Skip device tests because the modified compiled-binding paths are covered without a device.

  • Controls.Xaml device tests exercise runtime binding parsing and compiled XAML resources, not compiled indexer paths.
  • No handlers, platform code, or device test infrastructure changed.

MAI Code 2 — Compiled binding path parsing and unit-test-only changes require no device tests.

  • The affected code is XamlC and source-generator infrastructure, not runtime device control behavior.
  • Changed tests are unit tests, not device tests, and no device handlers or platform code changed.
  • Compiled binding cases are covered by the added SourceGen and XAML unit tests.

Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.

@github-actions github-actions Bot added s/autopilot-waiting-for-maintainer-review MAUI Autopilot finished: expert review clean and tests passed; waiting for maintainer review and removed s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run labels Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

MAUI Autopilot — Ready for maintainer review

Results
Expert review No more findings on 0d4ff1c
Tests No UI or device tests affected
Review threads 9 resolved

kubaflo added a commit that referenced this pull request Nov 27, 2026
… unit tests (#40732)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

Repository infrastructure. Agentic workflows run from the default
branch, so it targets `main`.

### Description of Change

MAUI Autopilot fix rounds couldn't run any unit tests on `main`: the
runner's SDK is older than the one `global.json` pins
(`12.0.100-alpha…`). On #40724 every thread reply said the tests "could
not run without the .NET 12 SDK".

- `maui-expert-autopilot` and `maui-expert-autopilot-opus` now install
the SDK pinned in the **base branch's** `global.json` (not the PR's)
before the agent starts. It goes into the runner tool cache, which the
agent container puts on `PATH`.
- `pkgs.dev.azure.com` is allowed so the repo's NuGet feeds restore.
- The prompt points at the Controls, XAML and SourceGen unit-test
projects.

#### Validation

- Fork probe
([run](https://github.com/kubaflo/maui/actions/runs/46027528623)) with
`main`'s `global.json`: inside the agent sandbox `dotnet --version`
printed `12.0.100-alpha.1.26523.103`, both in the workspace and in a
separate worktree (as the fix candidates use).
- `gh aw compile maui-expert-autopilot maui-expert-autopilot-opus`:
passed.

### Issues Fixed

None.

### Let AI finish this PR

- [ ] **Let the MAUI agent address review feedback and fix remaining
issues on this PR.** Maintainers still decide whether it is merged. For
PRs from forks, the agent opens a follow-up PR that keeps your commits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo kubaflo closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

s/autopilot-waiting-for-maintainer-review MAUI Autopilot finished: expert review clean and tests passed; waiting for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Binding to dictionary with string key

3 participants