Repository navigation
Fix typed bindings invoking generated getters with missing ancestor sources - #39470
Conversation
This pull request updates the following dependencies [marker]: <> (Begin:a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95) ## From https://github.com/dotnet/xharness - **Subscription**: [a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95](https://maestro.dot.net/subscriptions?search=a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95) - **Build**: [20261017.1](https://dev.azure.com/dnceng/internal/_build/results?buildId=3108278) ([337047](https://maestro.dot.net/channel/2/github:dotnet:xharness/build/337047)) - **Date Produced**: October 17, 2026 7:49:04 PM UTC - **Commit**: [38ed2081279c3f4dee81c933aaa9721b50a44adb](dotnet/xharness@38ed208) - **Branch**: [main](https://github.com/dotnet/xharness/tree/main) [DependencyUpdate]: <> (Begin) - **Dependency Updates**: - From [11.0.0-prerelease.26506.1 to 11.0.0-prerelease.26517.1][1] - Microsoft.DotNet.XHarness.CLI - Microsoft.DotNet.XHarness.TestRunners.Common - Microsoft.DotNet.XHarness.TestRunners.Xunit [1]: dotnet/xharness@91708f0...38ed208 [DependencyUpdate]: <> (End) [marker]: <> (End:a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95) Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
<!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Preserve the identity metadata required by Memory Leak Fixer's GitHub integrity guard. The [reported run](https://github.com/dotnet/maui/actions/runs/39183685618) already loaded `min-integrity: approved` and `trusted-users: ["github-actions[bot]"]`, including the trust correction from #39332. However, its MCP `list_issues` and `search_issues` calls requested projected `fields` without `user` or `author_association`. Field selection happens before guard evaluation, so the guard could not recognize the scanner's trusted bot identity. Issue #37848 was consequently filtered at `unapproved` integrity. The workflow now explicitly requires all MCP issue/PR list and search calls to omit `fields`, retain the original metadata through the guard, and reduce only permitted results locally. This covers review-response discovery, leak selection, deduplication, and attempt caps. Queries must scope to workflow candidates, and filtered/failed evidence must stop publication rather than look like an empty or complete inventory. Approved integrity, bot trust, permissions, firewall, threat detection, safe-output restrictions, and all action/container/model pins remain unchanged. The regenerated lock changes only the prompt body hash. The fix does not permit raw-REST retries, alternate-tool access to withheld content, or a lower integrity threshold. Validation: - `gh aw compile leak-fixer --strict --shellcheck --no-check-update --json` - passed with no errors or warnings; retained the original action/container pins using the local compiler pin cache and restored that cache afterward. - `gh aw compile leak-fixer --strict --staged --no-emit --no-check-update --json` - passed with no errors or warnings. - `git diff --check` - passed. - `actionlint -format '{{json .}}' .github/workflows/leak-fixer.lock.yml` - reports the same four diagnostics as the untouched base (two unsupported generated `concurrency.queue` keys, existing SC2129 style advice, and an existing `github.aw` import expression). No new diagnostics. - Read-only GPT-6.1 Sol security review of the final source/lock change - passed; no confirmed vulnerabilities. No pipeline tests were added. `--dry-run` is unavailable in the pinned gh-aw v0.86.2 compiler; the commands above are configuration checks, not a live dry-run. No agent workflow was dispatched, and hosted recovery remains unverified until the revised workflow runs. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #39447 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa3864d1-3642-4dd3-a02b-90c0ed19eb6d
Recheck source compatibility on every binding application so recycled ancestor bindings never invoke generated getters with null or incompatible sources. Cover recovery and fallback behavior across binding modes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39470Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39470" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
PR Test Gate
🧪 Gate analysis — click to expand❌ Failed. The selected tests did not meet the expected outcomes. Inspect the evidence before changing the test or fix. 🧪 Unit tests
Execution log excerptsWithout fix With fix PR head: 5577f2e8. Without-fix baseline: b36d97a9. |
|
the pr targets the new .net 11 not 10 but i can confirm that it fixed the issue @jfversluis |
There was a problem hiding this comment.
🔵 Needs a closer look
The shared binding-engine change needs human review because current CI results and reported runtime validation were not independently verified.
No open issues 🎉
What changed in this PR
Fixes #38667 in shared typed-binding code by rechecking source compatibility before invoking generated getters.
Changes:
- Replaces cached source-type checks with validation on every application.
- Deduplicates consecutive source-type mismatch diagnostics.
- Adds regression coverage for source transitions, fallback values, recovery, and three binding modes.
| File | Description |
|---|---|
| src/Controls/tests/Core.UnitTests/TypedBindingUnitTests.cs | Adds getter-invocation and source-recovery regression tests. |
| src/Controls/src/Core/TypedBinding.cs | Revalidates sources and tracks repeated mismatch diagnostics. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📊 maui-prNo failures found. 🧪 maui-pr-devicetests
🧪 maui-pr-uitestsTarget matches below reproduce the same platform/reason on
Insufficient data - UI evidence: only 100/446 failed-result records captured; canceled Shell/Label/Layout legs and bounded target samples prevent exhaustive attribution. 🧭 Follow-up — actions and refreshNext action: Restore complete results and first-crash diagnostics; compare unresolved cases with/without the binding fix.
|
…ources (#39470) <!-- 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! Recheck source compatibility on every `TypedBinding.ApplyCore` invocation instead of caching it alongside the target property's default value. During Windows CollectionView recycling, a template can temporarily lose its ancestor. `RelativeBindingSource` intentionally applies a null source until the ancestor becomes available again. The previously cached successful type check allowed the null source through to SourceGen getters such as `source => (source.UseCommand, true)`, causing a first-chance `NullReferenceException`. The reverse transition could also leave a binding using a cached unsuccessful check after a compatible source became available. This change prevents getter invocation for null or incompatible sources, restores binding values when a compatible source returns, and deduplicates consecutive source-type mismatch diagnostics. It does not retain the source strongly or change the public API. The fix is in shared binding code; Windows is the runtime-validated platform, not an exclusive scope claim. Regression tests count getter invocations, so they detect the exception even when the binding engine catches it. Coverage includes valid/null/incompatible/valid transitions, fallback values, initial incompatible-source recovery, and OneWay, OneTime, and TwoWay modes. - Reproduced with the public sample from #38667 using Microsoft.Maui.Controls 10.0.110, SourceGen, and Windows ARM64. - Added an instrumented runtime harness in a local scratch copy of the sample: incremental animated scrolling, large scrolling jumps, dynamic-resource replacement, ItemsSource reset, and ancestor detach/reattach. - Before: 6,094 matching first-chance exceptions in generated command getters. These were caught by the binding engine; the standalone process did not terminate. - After: zero matching exceptions in two complete five-scenario runs. Confirmed the running app loaded the source-built Windows Controls assembly, and a real item-command click still updated the UI. - Regression cases failed against the unchanged implementation and pass with the fix. The final five regression cases pass locally. - Broader TypedBinding tests: 115 passed, 2 skipped, and one `FailToConvert` failure also reproduced on the unchanged baseline. - Runtime harness/logs are local investigation artifacts, not additions to the repository. Android and iOS runtime verification has not been performed. Fixes #38667 ---------
…ources (#39470) <!-- 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! Recheck source compatibility on every `TypedBinding.ApplyCore` invocation instead of caching it alongside the target property's default value. During Windows CollectionView recycling, a template can temporarily lose its ancestor. `RelativeBindingSource` intentionally applies a null source until the ancestor becomes available again. The previously cached successful type check allowed the null source through to SourceGen getters such as `source => (source.UseCommand, true)`, causing a first-chance `NullReferenceException`. The reverse transition could also leave a binding using a cached unsuccessful check after a compatible source became available. This change prevents getter invocation for null or incompatible sources, restores binding values when a compatible source returns, and deduplicates consecutive source-type mismatch diagnostics. It does not retain the source strongly or change the public API. The fix is in shared binding code; Windows is the runtime-validated platform, not an exclusive scope claim. Regression tests count getter invocations, so they detect the exception even when the binding engine catches it. Coverage includes valid/null/incompatible/valid transitions, fallback values, initial incompatible-source recovery, and OneWay, OneTime, and TwoWay modes. - Reproduced with the public sample from #38667 using Microsoft.Maui.Controls 10.0.110, SourceGen, and Windows ARM64. - Added an instrumented runtime harness in a local scratch copy of the sample: incremental animated scrolling, large scrolling jumps, dynamic-resource replacement, ItemsSource reset, and ancestor detach/reattach. - Before: 6,094 matching first-chance exceptions in generated command getters. These were caught by the binding engine; the standalone process did not terminate. - After: zero matching exceptions in two complete five-scenario runs. Confirmed the running app loaded the source-built Windows Controls assembly, and a real item-command click still updated the UI. - Regression cases failed against the unchanged implementation and pass with the fix. The final five regression cases pass locally. - Broader TypedBinding tests: 115 passed, 2 skipped, and one `FailToConvert` failure also reproduced on the unchanged baseline. - Runtime harness/logs are local investigation artifacts, not additions to the repository. Android and iOS runtime verification has not been performed. Fixes #38667 ---------
…ources (#39470) <!-- 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! Recheck source compatibility on every `TypedBinding.ApplyCore` invocation instead of caching it alongside the target property's default value. During Windows CollectionView recycling, a template can temporarily lose its ancestor. `RelativeBindingSource` intentionally applies a null source until the ancestor becomes available again. The previously cached successful type check allowed the null source through to SourceGen getters such as `source => (source.UseCommand, true)`, causing a first-chance `NullReferenceException`. The reverse transition could also leave a binding using a cached unsuccessful check after a compatible source became available. This change prevents getter invocation for null or incompatible sources, restores binding values when a compatible source returns, and deduplicates consecutive source-type mismatch diagnostics. It does not retain the source strongly or change the public API. The fix is in shared binding code; Windows is the runtime-validated platform, not an exclusive scope claim. Regression tests count getter invocations, so they detect the exception even when the binding engine catches it. Coverage includes valid/null/incompatible/valid transitions, fallback values, initial incompatible-source recovery, and OneWay, OneTime, and TwoWay modes. - Reproduced with the public sample from #38667 using Microsoft.Maui.Controls 10.0.110, SourceGen, and Windows ARM64. - Added an instrumented runtime harness in a local scratch copy of the sample: incremental animated scrolling, large scrolling jumps, dynamic-resource replacement, ItemsSource reset, and ancestor detach/reattach. - Before: 6,094 matching first-chance exceptions in generated command getters. These were caught by the binding engine; the standalone process did not terminate. - After: zero matching exceptions in two complete five-scenario runs. Confirmed the running app loaded the source-built Windows Controls assembly, and a real item-command click still updated the UI. - Regression cases failed against the unchanged implementation and pass with the fix. The final five regression cases pass locally. - Broader TypedBinding tests: 115 passed, 2 skipped, and one `FailToConvert` failure also reproduced on the unchanged baseline. - Runtime harness/logs are local investigation artifacts, not additions to the repository. Android and iOS runtime verification has not been performed. Fixes #38667 ---------
…ources (#39470) <!-- 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! Recheck source compatibility on every `TypedBinding.ApplyCore` invocation instead of caching it alongside the target property's default value. During Windows CollectionView recycling, a template can temporarily lose its ancestor. `RelativeBindingSource` intentionally applies a null source until the ancestor becomes available again. The previously cached successful type check allowed the null source through to SourceGen getters such as `source => (source.UseCommand, true)`, causing a first-chance `NullReferenceException`. The reverse transition could also leave a binding using a cached unsuccessful check after a compatible source became available. This change prevents getter invocation for null or incompatible sources, restores binding values when a compatible source returns, and deduplicates consecutive source-type mismatch diagnostics. It does not retain the source strongly or change the public API. The fix is in shared binding code; Windows is the runtime-validated platform, not an exclusive scope claim. Regression tests count getter invocations, so they detect the exception even when the binding engine catches it. Coverage includes valid/null/incompatible/valid transitions, fallback values, initial incompatible-source recovery, and OneWay, OneTime, and TwoWay modes. - Reproduced with the public sample from #38667 using Microsoft.Maui.Controls 10.0.110, SourceGen, and Windows ARM64. - Added an instrumented runtime harness in a local scratch copy of the sample: incremental animated scrolling, large scrolling jumps, dynamic-resource replacement, ItemsSource reset, and ancestor detach/reattach. - Before: 6,094 matching first-chance exceptions in generated command getters. These were caught by the binding engine; the standalone process did not terminate. - After: zero matching exceptions in two complete five-scenario runs. Confirmed the running app loaded the source-built Windows Controls assembly, and a real item-command click still updated the UI. - Regression cases failed against the unchanged implementation and pass with the fix. The final five regression cases pass locally. - Broader TypedBinding tests: 115 passed, 2 skipped, and one `FailToConvert` failure also reproduced on the unchanged baseline. - Runtime harness/logs are local investigation artifacts, not additions to the repository. Android and iOS runtime verification has not been performed. Fixes #38667 ---------
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!
Description of Change
Recheck source compatibility on every
TypedBinding.ApplyCoreinvocation instead of caching it alongside the target property's default value.During Windows CollectionView recycling, a template can temporarily lose its ancestor.
RelativeBindingSourceintentionally applies a null source until the ancestor becomes available again. The previously cached successful type check allowed the null source through to SourceGen getters such assource => (source.UseCommand, true), causing a first-chanceNullReferenceException. The reverse transition could also leave a binding using a cached unsuccessful check after a compatible source became available.This change prevents getter invocation for null or incompatible sources, restores binding values when a compatible source returns, and deduplicates consecutive source-type mismatch diagnostics. It does not retain the source strongly or change the public API. The fix is in shared binding code; Windows is the runtime-validated platform, not an exclusive scope claim.
Regression tests count getter invocations, so they detect the exception even when the binding engine catches it. Coverage includes valid/null/incompatible/valid transitions, fallback values, initial incompatible-source recovery, and OneWay, OneTime, and TwoWay modes.
Verification
FailToConvertfailure also reproduced on the unchanged baseline.Issues Fixed
Fixes #38667