Fix CI failure for CollectionView and CarouselView tests in April 14th Candidate#35028
Merged
kubaflo merged 2 commits intoApr 18, 2026
Conversation
Contributor
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Apr 18, 2026
Open
kubaflo
approved these changes
Apr 18, 2026
This was referenced Apr 18, 2026
Closed
This was referenced Apr 19, 2026
Ahamed-Ali
pushed a commit
that referenced
this pull request
Apr 22, 2026
…h Candidate (#35028) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue details: PR #24610 switched collection change wiring to a weak event proxy to fix a memory leak, but the callback delegate was not strongly retained. As a result, GC could collect the delegate, so CollectionChanged notifications stopped reaching the Android items pipeline, which caused the CarouselView and CollectionView test failures. ### Description of Change <!-- Enter description of the fix in this section --> In MarshalingObservableCollection.cs, added a strong field to hold the NotifyCollectionChangedEventHandler delegate. In the constructor, assigned that field once and passed the stored delegate to WeakNotifyCollectionChangedProxy instead of passing a temporary method-group delegate. Kept existing dispose/unsubscribe behavior so the leak fix remains intact while notifications continue to fire correctly. ### Failure test cases **CarouselView tests fails** * VerifyCarouselViewWithKeepItemInView * VerifyCarouselViewWithKeepItemInViewAndPreviousPosition * VerifyCarouselViewWithKeepItemInViewAndCurrentPosition * VerifyCarouselViewWithCurrentPosition * VerifyCarouselViewWithKeepLastItemInViewAndCurrentPosition * AddItemsToCarouselViewWorks **CollectionView test fails** * VerifyModelItemsObservableCollectionWhenAddIndexAtItems * VerifyFlowDirectionRTLAndKeepLastItemInViewWithObservableListWhenVerticalGrid * VerifyFlowDirectionLTRAndKeepLastItemInViewWithObservableListWhenVerticalGrid * VerifyKeepLastItemInViewWithObservableListWhenVerticalGrid * VerifyKeepLastItemInViewWithObservableList * VerifyFlowDirectionLTRAndKeepLastItemInViewWithObservableListWhenHorizontalList * VerifyFlowDirectionRTLAndKeepLastItemInViewWithObservableListWhenHorizontalList * VerifyFlowDirectionRTLAndKee **Device Test fails** * CollectionViewCanSizeToContent
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Issue details:
PR #24610 switched collection change wiring to a weak event proxy to fix a memory leak, but the callback delegate was not strongly retained. As a result, GC could collect the delegate, so CollectionChanged notifications stopped reaching the Android items pipeline, which caused the CarouselView and CollectionView test failures.
Description of Change
In MarshalingObservableCollection.cs, added a strong field to hold the NotifyCollectionChangedEventHandler delegate.
In the constructor, assigned that field once and passed the stored delegate to WeakNotifyCollectionChangedProxy instead of passing a temporary method-group delegate.
Kept existing dispose/unsubscribe behavior so the leak fix remains intact while notifications continue to fire correctly.
Issue Fixed
Fixes #35104
Failure test cases
CarouselView tests fails
CollectionView test fails
Device Test fails