CardView.MAUI icon indicating copy to clipboard operation
CardView.MAUI copied to clipboard

Artifacts When Replacing ItemsSource

Open reid-kirkpatrick opened this issue 1 year ago • 12 comments

When IsViewReusingEnabled is enabled we're getting artifacts from previous views when replacing the bound ItemsSource

https://github.com/user-attachments/assets/d23dc77d-6783-4de2-a419-0579394954f5

Repro: https://github.com/reid-kirkpatrick/CarouselLeaks Just remove IsViewReusingEnabled from the MainPage

reid-kirkpatrick avatar Feb 13 '25 17:02 reid-kirkpatrick

Hey @reid-kirkpatrick, thanks for the report what platform does this bug affect? All or just a single one? (Windows, I guess?)

CC @DashTheDev

AndreiMisiukevich avatar Feb 14 '25 00:02 AndreiMisiukevich

Hey @reid-kirkpatrick, thanks for the report what platform does this bug affect? All or just a single one? (Windows, I guess?)

CC @DashTheDev

Windows and iOS for sure. I can test Android tomorrow

reid-kirkpatrick avatar Feb 14 '25 00:02 reid-kirkpatrick

I should get some time to look into this and #43 today or over the weekend.

Thanks for the repro project @reid-kirkpatrick 😄

DashTheDev avatar Feb 14 '25 00:02 DashTheDev

I tried testing the repro project on Android, but can't even get the carousel to swipe for some reason 😬

reid-kirkpatrick avatar Feb 14 '25 16:02 reid-kirkpatrick

Hey @AndreiMisiukevich,

I had a bit of a look at this when I had some free time, but I'm going to need to sit down for longer to fully understand what's going on in the ForceRedrawViews() and the processor so I'm not just changing things blindly (causing more issues). Which I don't think I'm going to have time for at the moment.

I can continue looking into after this week coming, or maybe some bits and pieces here and there during the week. But ultimately might be faster for you to look into this one if you get the chance. Otherwise all good I'll get to it when I can 😄

DashTheDev avatar Feb 16 '25 02:02 DashTheDev

@reid-kirkpatrick, could you check the latest 1.1.1 version? (if not difficult) I fixed another bug but it might be the same root cause

AndreiMisiukevich avatar Feb 16 '25 02:02 AndreiMisiukevich

@AndreiMisiukevich thanks for the quick turnaround! Unfortunately I didn't see any difference in behavior (at least on Windows) in 1.1.1

reid-kirkpatrick avatar Feb 17 '25 16:02 reid-kirkpatrick

Well, you can try something hacky

Try to clear children completely before changing source like Children.Clear() and then Update source

AndreiMisiukevich avatar Feb 20 '25 03:02 AndreiMisiukevich

Has you PR solved this issue too?

AndreiMisiukevich avatar Feb 28 '25 00:02 AndreiMisiukevich

Has you PR solved this issue too?

Sorry for the delay on this! I'll try to test it and get back to you next week

reid-kirkpatrick avatar Mar 04 '25 19:03 reid-kirkpatrick

@AndreiMisiukevich I can't tell that anything has changed here. It's not urgent for us now that the memory leak has been fixed though

reid-kirkpatrick avatar Mar 04 '25 21:03 reid-kirkpatrick

I tried testing the repro project on Android, but can't even get the carousel to swipe for some reason 😬

Hey! FYI, I redownloaded this repro project to see why swipe wasn't working on Android. Once I added the following line in MauiProgram.cs it started working.

Image

DashTheDev avatar Sep 19 '25 00:09 DashTheDev