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

WinUi CollectionView is not recycling containers. #8151

Open
Keflon opened this issue Jun 18, 2022 · 6 comments
Open

WinUi CollectionView is not recycling containers. #8151

Keflon opened this issue Jun 18, 2022 · 6 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)
Milestone

Comments

@Keflon
Copy link

Keflon commented Jun 18, 2022

Description

The WinUI CollectionView does not recycle item-containers and instead creates a new item-container every time some data scrolls into view.

Steps to Reproduce

Minimum repo:

https://github.com/Keflon/MauiRecycleBug

Steps:

Create a CollectionView
Fill it with items
Scroll up and down in the CollectionView
For the sample, watch the Debug output.

Android

A small number of CollectionItem instances are created and these are recycled.
Example Debug output:
Created CollectionItem. InstanceId: 12. There are 12 instances allocated

WinUI

A new CollectionItem is created every time an instance scrolls into view.
Example Debug output:
Created CollectionItem. InstanceId: 133. There are 133 instances allocated

Scrolling quickly to the end and back (e.g. by dragging the scroll-bar) causes a CRASH

Scrolling slowly can eventually instigate an item being garbage-collected
Example Debug output:
Collected CollectionItem. InstanceId: 9. There are 129 instances allocated

Related: The DataTemplate in the sample code has a CheckBox.

  1. The CheckBox is rendered incorrectly until the Window is resized horizontally.
    1. Should I open a new bug for this?
  2. Having the CheckBox present in the DataTemplate causes a LOT of memory to be consumed, leading to an OutOfMemoryException
    1. Is this a separate bug?

Version with bug

6.0.400 (current)

Last version that worked well

6.0 Release Candidate 3

Affected platforms

Windows

Affected platform versions

Latest

Did you find any workaround?

Note: I can't confirm 100% this worked in the previous release because I don't know how to roll-back, but I'm certain this is a new problem.

Relevant log output

No response

@Keflon Keflon added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jun 18, 2022
@Keflon
Copy link
Author

Keflon commented Jun 18, 2022

Addendum:

The CheckBox is rendered incorrectly until the Window is resized horizontally.

If the CheckBox is rendered incorrectly, i.e. the containing Window is not resized horizontally, then dragging the scroll-bar quickly down does not lead to a crash. (Though we still get OutOfMemory rather quickly if we waggle the scroll-bar up and down) Hope that's a useful clue :)

@jsuarezruiz jsuarezruiz added legacy-area-perf Startup / Runtime performance area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/windows 🪟 labels Jun 20, 2022
@jfversluis jfversluis removed the s/needs-verification Indicates that this issue needs initial verification before further triage will happen label Jun 20, 2022
@kristinx0211
Copy link

Can be verified that the above issue exist using above repro project on windows.

@kristinx0211 kristinx0211 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jun 21, 2022
@rachelkang rachelkang added this to the 6.0-servicing milestone Jun 27, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 5, 2023
@homeyf homeyf added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Jul 24, 2023
@homeyf
Copy link

homeyf commented Jul 24, 2023

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 3.0. Can repro on Windows platform with sample project.
https://github.com/Keflon/MauiRecycleBug
demo3

@IlyaSemenchenkoIfs
Copy link

I also can reproduce the behavior described here, every time CollectionView, instead of reusing view, creates a new one

@Hunv
Copy link

Hunv commented Mar 3, 2024

This issue is making me problems since 2015. I think it is the WinUI control that is not working as expected. BUT this issue is also on Android (cannot check iOS).
Here is also some sample code: https://stackoverflow.com/questions/31817050/listview-caching-in-windows-ui

@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) and removed legacy-area-perf Startup / Runtime performance labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)
Projects
None yet
Development

No branches or pull requests