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
[net8.0] Fix cells leak tests #16231
Conversation
} | ||
} | ||
//[Fact("Cells Do Not Leak")] | ||
//public async Task CellsDoNotLeak() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use just Skip with a comment (the comment will help to understand the status). Also, should we create a related issue where @jonathanpeppers could work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix this test. Can you share cases where it failed?
It's already caught a new leak that was introduced in: #15856
@jonathanpeppers first time it started was with Android bump commit 310d5d4 doesn't make much sense |
Let's try this: #16237 And then it's possible there is something that is going wrong in .NET 8? If this still fails. |
I've found the most reliable way to make DeviceTests run the GC for all platforms is: Assert.NotNull(pageReference); await AssertionExtensions.Wait(() => { GC.Collect(); GC.WaitForPendingFinalizers(); return !pageReference.IsAlive; }, timeout: 5000); Let's standardize on this, so we can instead do: await AssertionExtensions.WaitForGC(pageReference); And if you have multiple: await AssertionExtensions.WaitForGC(pageReference, handlerReference); The helper method also checks if the `params WeakReference[]` is empty, or any `WeakReference` are null. I simplified various tests with this change. # Conflicts: # src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs
GC.Collect(); | ||
GC.WaitForPendingFinalizers(); | ||
|
||
await AssertionExtensions.WaitForGC(labels.ToArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok awesome! Glad this fixed it.
Description of Change
Try get a green build for net8.0