Description
During some contributions, I figured out that memory leak unit tests are passing even if a memory leak happens. It can introduce bugs and a false security sensation.
I did create a test that will fail, and it passes even if there's a leak.
Steps to Reproduce
Add this test method inside the Controls.DeviceTests
[Fact]
public async Task FailIfLeak()
{
var page = new ContentPage { Title = "Page 1" };
await CreateHandlerAndAddToWindow(new Window(page), async () =>
{
await OnLoadedAsync(page);
});
await AssertionExtensions.WaitForGC(new WeakReference(page));
GC.KeepAlive(page);
}
Run it and see the success message.
Link to public reproduction project repository
https://github.com/pictos/maui/tree/pj/device-test-fail
Version with bug
10.0.60
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
Windows, Android, iOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
Description
During some contributions, I figured out that memory leak unit tests are passing even if a memory leak happens. It can introduce bugs and a false security sensation.
I did create a test that will fail, and it passes even if there's a leak.
Steps to Reproduce
Add this test method inside the
Controls.DeviceTestsRun it and see the success message.
Link to public reproduction project repository
https://github.com/pictos/maui/tree/pj/device-test-fail
Version with bug
10.0.60
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
Windows, Android, iOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output