[Windows] Fix FlexLayoutCycleException test failure on candidate branch#34756
Merged
kubaflo merged 1 commit intodotnet:inflight/candidatefrom Mar 31, 2026
Merged
Conversation
kubaflo
approved these changes
Mar 31, 2026
sheiksyedm
pushed a commit
that referenced
this pull request
Apr 4, 2026
…ch (#34756) > [!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! ### Root Cause PR #24867 deferred the OnItemsVectorChanged logic into an async DispatcherQueue.TryEnqueue lambda. Later, PR #34534 introduced DisconnectHandlers() in CleanUpCollectionViewSource, which sets base.VirtualView to null before the queued lambda executes. **Test name:** FlexLayoutCycleException ### Description of Change This PR resolves the `FlexLayoutCycleException` test failure on the candidate branch. In ItemsViewHandler.Windows.cs, the guards inside the OnItemsVectorChanged lambda were updated from: if (VirtualView is null) return; to: if (((IViewHandler)this).VirtualView is null) return; No other changes were made. **Cause PR:** #34534 ### Test result | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="300" height="600" src="https://github.com/user-attachments/assets/ac0d8e92-8c20-4647-8334-b3dcbaa96a64"> | <img width="300" height="600" src="https://github.com/user-attachments/assets/77010f17-8db3-4ffe-9a51-ba19e4b5079c"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
PR #24867 deferred the OnItemsVectorChanged logic into an async DispatcherQueue.TryEnqueue lambda. Later, PR #34534 introduced DisconnectHandlers() in CleanUpCollectionViewSource, which sets base.VirtualView to null before the queued lambda executes.
Test name: FlexLayoutCycleException
Description of Change
This PR resolves the
FlexLayoutCycleExceptiontest failure on the candidate branch. In ItemsViewHandler.Windows.cs, the guards inside the OnItemsVectorChanged lambda were updated from: if (VirtualView is null) return; to: if (((IViewHandler)this).VirtualView is null) return; No other changes were made.Cause PR: #34534
Test result