Repository navigation
[Inflight/Current] [Windows] Fix CollectionView selection crash during handler disconnection - #39005
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Note 🔍
|
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 2 findings
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
|
/azp run |
@kubaflo, the internal validation for the fix is in progress. I will open the PR once it is completed. |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
AI Review Summary
🗂️ Review Sessions — click to expand🚦 Gate — Test Before & After FixGate Result: ✅ PASSEDPlatform: WINDOWS · Base: inflight/current · Merge base:
🔴 Without fix — 🖥️ Issue38618: FAIL ✅ · 640sError-relevant lines (filtered from the build log): 🟢 With fix — 🖥️ Issue38618: PASS ✅ · 508s(no coded error found; showing last 1200 chars) 📁 Fix files reverted (1 files)
📋 Pre-Flight — Context & ValidationThe Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase. Next step: re-comment 🔬 Code Review — Deep AnalysisThe Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase. Next step: re-comment 🛠️ Try-Fix — Analysis & ComparisonThe Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase. Next step: re-comment 🏁 Report — Final RecommendationThe Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase. Next step: re-comment 📱 UI Tests — CollectionViewDetected UI test categories:
🧭 Next Steps — review latest findingsNo alternative fix was selected for this run. Review the session findings and CI results before merging. |
|
/backport to inflight/candidate |
|
Started backporting to |
<!-- 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 --> Backport of #39005 to `inflight/candidate`, intentionally targeting the SR12 staging branch rather than `main`. This is a documented 10.0.120/inflight regression fix, not a general inflight-content merge. Preserves the native Windows selection sender and checks handler identity around virtual selection updates, avoiding access through a disconnected handler. Includes the original Issue38618 regression page and UI test, with no unrelated changes. Source merge: `262d95940f646b601093b36db4e27c691670d753`. Backport head: `9650361075f0b122a6eed657998bb2891506a709`. **Validation** - `git diff --binary 3d96e23 9650361 | git patch-id --stable` — passed: complete binary-inclusive source patch identity matches `7cda846792d278b63cf080958e2a6520eb0e0b7f`. - `git diff --check 3d96e23 9650361` — passed. - Local builds and runtime/UI tests were not rerun for this unchanged automated replay. PR-head CI results are pending; this is not a merge-readiness verdict. No XCTest, Appium, simulator/emulator or GUI execution was performed. ### 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 #38618 in the SR12 Candidate selection. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> /cc @kubaflo @BagavathiPerumal Co-authored-by: BagavathiPerumal <93652794+BagavathiPerumal@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…g handler disconnection (#39005) <!-- 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. !!!!!!! --> ### Root cause The issue occurs because the CollectionView selection callback continues after Window.Page is replaced with the L2 Shell. The page replacement disconnects the existing CollectionView handler, which clears its PlatformView. When the selection flow continues and updates SelectedItem, UpdateVirtualSelection() attempts to access the handler's ListViewBase after the PlatformView has already been cleared, resulting in an InvalidOperationException. ### Solution description The fix involves preserving the native ListViewBase instance received from the selection-change event and using it throughout the selection synchronization process. The handler's current PlatformView is also checked before updating the item content controls. This prevents access to a cleared platform view when the handler is disconnected during selection processing while retaining the handler-disconnection behavior introduced by PR #38022. ### Regression PR PR #38022 Validated the behavior in the following platforms - [x] Windows - [ ] Mac - [ ] Android - [ ] iOS ### Issues Fixed Fixes #38618 ### Output ScreenShot |Platform|Before|After| |--|--|--| |Windows| <video src="https://github.com/user-attachments/assets/b58de799-1698-4e46-94f2-8d78cc36c57b">| <video src="https://github.com/user-attachments/assets/434c9881-df2e-42b0-a0b6-de25b029fa22">| ---------
<!-- 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 --> Backport of #39005 to `inflight/candidate`, intentionally targeting the SR12 staging branch rather than `main`. This is a documented 10.0.120/inflight regression fix, not a general inflight-content merge. Preserves the native Windows selection sender and checks handler identity around virtual selection updates, avoiding access through a disconnected handler. Includes the original Issue38618 regression page and UI test, with no unrelated changes. Source merge: `262d95940f646b601093b36db4e27c691670d753`. Backport head: `9650361075f0b122a6eed657998bb2891506a709`. **Validation** - `git diff --binary 3d96e23 9650361 | git patch-id --stable` — passed: complete binary-inclusive source patch identity matches `7cda846792d278b63cf080958e2a6520eb0e0b7f`. - `git diff --check 3d96e23 9650361` — passed. - Local builds and runtime/UI tests were not rerun for this unchanged automated replay. PR-head CI results are pending; this is not a merge-readiness verdict. No XCTest, Appium, simulator/emulator or GUI execution was performed. ### 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 #38618 in the SR12 Candidate selection. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> /cc @kubaflo @BagavathiPerumal Co-authored-by: BagavathiPerumal <93652794+BagavathiPerumal@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…g handler disconnection (#39005) <!-- 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. !!!!!!! --> ### Root cause The issue occurs because the CollectionView selection callback continues after Window.Page is replaced with the L2 Shell. The page replacement disconnects the existing CollectionView handler, which clears its PlatformView. When the selection flow continues and updates SelectedItem, UpdateVirtualSelection() attempts to access the handler's ListViewBase after the PlatformView has already been cleared, resulting in an InvalidOperationException. ### Solution description The fix involves preserving the native ListViewBase instance received from the selection-change event and using it throughout the selection synchronization process. The handler's current PlatformView is also checked before updating the item content controls. This prevents access to a cleared platform view when the handler is disconnected during selection processing while retaining the handler-disconnection behavior introduced by PR #38022. ### Regression PR PR #38022 Validated the behavior in the following platforms - [x] Windows - [ ] Mac - [ ] Android - [ ] iOS ### Issues Fixed Fixes #38618 ### Output ScreenShot |Platform|Before|After| |--|--|--| |Windows| <video src="https://github.com/user-attachments/assets/b58de799-1698-4e46-94f2-8d78cc36c57b">| <video src="https://github.com/user-attachments/assets/434c9881-df2e-42b0-a0b6-de25b029fa22">| ---------
<!-- 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 --> Backport of #39005 to `inflight/candidate`, intentionally targeting the SR12 staging branch rather than `main`. This is a documented 10.0.120/inflight regression fix, not a general inflight-content merge. Preserves the native Windows selection sender and checks handler identity around virtual selection updates, avoiding access through a disconnected handler. Includes the original Issue38618 regression page and UI test, with no unrelated changes. Source merge: `262d95940f646b601093b36db4e27c691670d753`. Backport head: `9650361075f0b122a6eed657998bb2891506a709`. **Validation** - `git diff --binary 3d96e23 9650361 | git patch-id --stable` — passed: complete binary-inclusive source patch identity matches `7cda846792d278b63cf080958e2a6520eb0e0b7f`. - `git diff --check 3d96e23 9650361` — passed. - Local builds and runtime/UI tests were not rerun for this unchanged automated replay. PR-head CI results are pending; this is not a merge-readiness verdict. No XCTest, Appium, simulator/emulator or GUI execution was performed. ### 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 #38618 in the SR12 Candidate selection. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> /cc @kubaflo @BagavathiPerumal Co-authored-by: BagavathiPerumal <93652794+BagavathiPerumal@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…g handler disconnection (#39005) <!-- 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. !!!!!!! --> ### Root cause The issue occurs because the CollectionView selection callback continues after Window.Page is replaced with the L2 Shell. The page replacement disconnects the existing CollectionView handler, which clears its PlatformView. When the selection flow continues and updates SelectedItem, UpdateVirtualSelection() attempts to access the handler's ListViewBase after the PlatformView has already been cleared, resulting in an InvalidOperationException. ### Solution description The fix involves preserving the native ListViewBase instance received from the selection-change event and using it throughout the selection synchronization process. The handler's current PlatformView is also checked before updating the item content controls. This prevents access to a cleared platform view when the handler is disconnected during selection processing while retaining the handler-disconnection behavior introduced by PR #38022. ### Regression PR PR #38022 Validated the behavior in the following platforms - [x] Windows - [ ] Mac - [ ] Android - [ ] iOS ### Issues Fixed Fixes #38618 ### Output ScreenShot |Platform|Before|After| |--|--|--| |Windows| <video src="https://github.com/user-attachments/assets/b58de799-1698-4e46-94f2-8d78cc36c57b">| <video src="https://github.com/user-attachments/assets/434c9881-df2e-42b0-a0b6-de25b029fa22">| ---------
<!-- 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 --> Backport of #39005 to `inflight/candidate`, intentionally targeting the SR12 staging branch rather than `main`. This is a documented 10.0.120/inflight regression fix, not a general inflight-content merge. Preserves the native Windows selection sender and checks handler identity around virtual selection updates, avoiding access through a disconnected handler. Includes the original Issue38618 regression page and UI test, with no unrelated changes. Source merge: `262d95940f646b601093b36db4e27c691670d753`. Backport head: `9650361075f0b122a6eed657998bb2891506a709`. **Validation** - `git diff --binary 3d96e23 9650361 | git patch-id --stable` — passed: complete binary-inclusive source patch identity matches `7cda846792d278b63cf080958e2a6520eb0e0b7f`. - `git diff --check 3d96e23 9650361` — passed. - Local builds and runtime/UI tests were not rerun for this unchanged automated replay. PR-head CI results are pending; this is not a merge-readiness verdict. No XCTest, Appium, simulator/emulator or GUI execution was performed. ### 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 #38618 in the SR12 Candidate selection. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> /cc @kubaflo @BagavathiPerumal Co-authored-by: BagavathiPerumal <93652794+BagavathiPerumal@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
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!
Root cause
The issue occurs because the CollectionView selection callback continues after Window.Page is replaced with the L2 Shell. The page replacement disconnects the existing CollectionView handler, which clears its PlatformView. When the selection flow continues and updates SelectedItem, UpdateVirtualSelection() attempts to access the handler's ListViewBase after the PlatformView has already been cleared, resulting in an InvalidOperationException.
Solution description
The fix involves preserving the native ListViewBase instance received from the selection-change event and using it throughout the selection synchronization process. The handler's current PlatformView is also checked before updating the item content controls. This prevents access to a cleared platform view when the handler is disconnected during selection processing while retaining the handler-disconnection behavior introduced by PR #38022.
Regression PR
PR #38022
Validated the behavior in the following platforms
Issues Fixed
Fixes #38618
Output ScreenShot
38618-BeforeFix.mp4
38618-AfterFix.mp4