Skip to content
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

[BUG] UniformItemsLayoutManager throws ArgumentException upon removing all children #1816

Closed
2 tasks done
Westhes opened this issue Apr 15, 2024 · 6 comments · Fixed by #2072
Closed
2 tasks done

[BUG] UniformItemsLayoutManager throws ArgumentException upon removing all children #1816

Westhes opened this issue Apr 15, 2024 · 6 comments · Fixed by #2072
Assignees
Labels
area/layouts Issue/Discussion/PR that has to do with Layouts bug Something isn't working unverified

Comments

@Westhes
Copy link

Westhes commented Apr 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

UniformsItemsLayoutManager throws an ArgumentNullException when all its children are removed.

Expected Behavior

UniformsItemsLayoutManager doesn't throw an exception and goes back to the state it would be in when instantiating without children.

Steps To Reproduce

  1. Build the provided repository for any platform
  2. Click the button.

Link to public reproduction project repository

Environment

- .NET MAUI CommunityToolkit: 8.0.1
- OS: Winodws 10
- .NET MAUI: 8

Anything else?

The exception is thrown by the Math.Clamp method at UniformItemsLayoutManager.shared.cs#L91 due to visibleChildrenCount being lower than the minimum value.
Simply adding columnsCount != 0 && to the if statement resolves this exception.

@Westhes Westhes added bug Something isn't working unverified labels Apr 15, 2024
@VladislavAntonyuk
Copy link
Collaborator

Most likely this is expected as you call Remove method with the Null parameter.

@Westhes
Copy link
Author

Westhes commented Apr 15, 2024

@VladislavAntonyuk step 4 was just an quick and generic way of removing a single child from the collection.
Calling UniformItemsLayout_Default.Children.Clear(); on the collection also throws this exception.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@dotnet-policy-service dotnet-policy-service bot added stale The author has not responded in over 30 days and removed stale The author has not responded in over 30 days labels Apr 19, 2024
@RWesthes
Copy link

Added reproduction project repository.

@vhugogarcia vhugogarcia added the area/layouts Issue/Discussion/PR that has to do with Layouts label Apr 19, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@dotnet-policy-service dotnet-policy-service bot added the stale The author has not responded in over 30 days label Apr 23, 2024
@Westhes
Copy link
Author

Westhes commented Apr 23, 2024

bump.
Also, can you remove the needs reproduction tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/layouts Issue/Discussion/PR that has to do with Layouts bug Something isn't working unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants