Skip to content

[Android] Fix crash starting the swipe on SwipeView inside CollectionView #27669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Fix crash starting the swipe on SwipeView inside CollectionView.

I have not been able to reproduce the crash on emulators or device (Pixel 8 Android 15) so I have applied changes based on reviewing the log attached to the issue.

Draft PR until we can reproduce it.

Issues Fixed

Fixes #26328

@sheiksyedm
Copy link
Contributor

@jsuarezruiz Since the crash is reproducing randomly on the Android platform in a Windows machine, we are unable to test the fix precisely. However, after applying the fix, the issue did not reproduce in multiple attempts. Additionally, we ensured that without the fix, the issue was reproduced in random scenarios. So, hope this PR will resolve the issue

@jsuarezruiz
Copy link
Contributor Author

/rebase

@jsuarezruiz jsuarezruiz marked this pull request as ready for review February 21, 2025 12:49
@Copilot Copilot AI review requested due to automatic review settings February 21, 2025 12:49
@jsuarezruiz jsuarezruiz requested a review from a team as a code owner February 21, 2025 12:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/Controls/tests/TestCases.HostApp/Issues/Issue26328.xaml: Language not supported
Comments suppressed due to low confidence (3)

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26328.cs:17

  • The test case should verify that the swipe items are correctly removed and that the crash is fixed.
[Category(UITestCategories.SwipeView)]

src/Core/src/Platform/Android/MauiSwipeView.cs:529

  • Ensure that the behavior introduced by the null check for _contentView.IsDisposed() is covered by tests.
if (_contentView == null || _contentView.IsDisposed() || _actionView != null)

src/Core/src/Platform/Android/MauiSwipeView.cs:548

  • Ensure that the behavior introduced by the null check for swipeItem is covered by tests.
AView? swipeItem = item?.ToPlatform(MauiContext);

@jfversluis jfversluis added this to the .NET 9 SR5 milestone Feb 25, 2025
@jfversluis jfversluis merged commit 515312b into main Feb 25, 2025
123 checks passed
@jfversluis jfversluis deleted the fix-26328 branch February 25, 2025 10:51
tj-devel709 pushed a commit that referenced this pull request Mar 3, 2025
…View (#27669)

* Added repro sample

* Added UITest

* Some changes based on the issue attached log (cannot repro the issue)
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SwipeView causes Java.Lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup
3 participants