Skip to content

Fixed ListView leak caused by not disposed ContextActionsCell #28702

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 2 commits into from
Apr 7, 2025

Conversation

VitalyKnyazev
Copy link
Contributor

Description of Change

In some cases ContextActionsCell is not disposed and this causes memory leak.
Remembering all instances and disposing them later so that there is no leak.
Tests show that number of instances is less than 30 even for 40k records in the data source collection.
It is not "proper" solution but it works, at least for scenarios tested so far.

Also first commit fixes apparent copy/paste bug.

Issues Fixed

Fixes #28689

@VitalyKnyazev VitalyKnyazev requested a review from a team as a code owner March 29, 2025 12:42
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 29, 2025
@rmarinho
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz jsuarezruiz added area-controls-listview ListView and TableView perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) perf/memory-leak 💦 Memory usage grows / objects live forever (sub: perf) labels Mar 31, 2025
@rmarinho rmarinho merged commit 1f5da58 into dotnet:main Apr 7, 2025
126 of 128 checks passed
rmarinho pushed a commit that referenced this pull request Apr 11, 2025
…r/Footer After Changing ItemsLayout in CV2 (#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (#28807)

* Resave mac tabbedpage images (#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Apr 11, 2025
…r/Footer After Changing ItemsLayout in CV2 (dotnet#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (dotnet#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (dotnet#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (dotnet#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (dotnet#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (dotnet#28807)

* Resave mac tabbedpage images (dotnet#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (dotnet#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (dotnet#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
PureWeen added a commit that referenced this pull request Apr 11, 2025
…r/Footer After Changing ItemsLayout in CV2 (#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (#28807)

* Resave mac tabbedpage images (#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
PureWeen added a commit that referenced this pull request Apr 16, 2025
…r/Footer After Changing ItemsLayout in CV2 (#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (#28807)

* Resave mac tabbedpage images (#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
sheiksyedm pushed a commit to sheiksyedm/maui that referenced this pull request Apr 17, 2025
…r/Footer After Changing ItemsLayout in CV2 (dotnet#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (dotnet#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (dotnet#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (dotnet#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (dotnet#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (dotnet#28807)

* Resave mac tabbedpage images (dotnet#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (dotnet#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (dotnet#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
NanthiniMahalingam pushed a commit to NanthiniMahalingam/maui that referenced this pull request Apr 17, 2025
…r/Footer After Changing ItemsLayout in CV2 (dotnet#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (dotnet#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (dotnet#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (dotnet#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (dotnet#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (dotnet#28807)

* Resave mac tabbedpage images (dotnet#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (dotnet#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (dotnet#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
github-actions bot pushed a commit that referenced this pull request Apr 18, 2025
…r/Footer After Changing ItemsLayout in CV2 (#28890)

* [Testing] Fix for flaky UITests in CI that occasionally fail - 7 (#28764)

* improve stability to flaky tests

* Updated changes

* Update CarouselViewUITests.LoopNoFreeze.cs

* Update EntryClearButtonColorShouldMatchTextColor.png

* Update CommunityToolkit.Maui reference in sample content template (#28510)

* Update CommunityToolkit.Maui & Mvvm reference in template

* Fix MAUI Toolkit breaking changes

* Debump MVVM Toolkit

* Update MauiApp.1.csproj

* Update package version in MauiApp.1.csproj

* Add framework-specific validation flags and update package version

* Swap TextValidationBehavior Flags for frameworks

* [Testing] Fix for flaky UITests in CI that occasionally fail - 6 (#28747)

* Fixed flaky tests related to entry control

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25473.cs

Co-authored-by: Copilot <[email protected]>

* fixed 19500 test

* reverted the common changes

* Fix typo in Issue19500.cs comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>

* Update dependencies from https://github.com/dotnet/xharness build 20250403.2 (#28819)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.25167.9 -> To Version 9.0.0-prerelease.25203.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update Issue19509.cs (#28807)

* Resave mac tabbedpage images (#28803)

* Fixed ListView leak caused by not disposed ContextActionsCell (#28702)

* Fixed something that looks like copy/paste error

* Fixed memory leak caused by not disposed ContextActionsCell

* [Testing] Fix for flaky UITests in CI that occasionally fail - 8 (#28828)

* improve stability to flaky test

* Update Issue7678.cs

* Fixed the TargetInvocationException Occurs When Selecting Header/Footer After Changing ItemsLayout in CV2

* Included the test case and sample for the fix

* Added the test case for footer

---------

Co-authored-by: HarishKumarSF4517 <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Anandhan Rajagopal <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Knyazev <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-listview ListView and TableView community ✨ Community Contribution perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) perf/memory-leak 💦 Memory usage grows / objects live forever (sub: perf)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] ViewCell with ContextActions causes memory leaks
3 participants