@@ -13,6 +13,7 @@
 using Xunit;
 using Xunit.Abstractions;
 using Xunit.Sdk;
+using static Microsoft.Maui.DeviceTests.AssertHelpers;
 
 
 namespace Microsoft.Maui.Handlers.Memory
@@ -69,16 +70,17 @@ public async Task CheckAllocation((Type ViewType, Type HandlerType) data)
 			if (!_fixture.HasType(data.HandlerType))
 				await Allocate(data);
 
-			var test = () => {
+			bool referencesCollected()
+			{
 				GC.Collect();
 				GC.WaitForPendingFinalizers();
 				GC.Collect();
 				GC.WaitForPendingFinalizers();
 
 				return !_fixture.DoReferencesStillExist(data.HandlerType);
-			};
+			}
 
-			await test.AssertEventually(timeout: 5000, message: $"{data.HandlerType} failed to collect.");
+			await AssertEventually(referencesCollected, timeout: 5000, message: $"{data.HandlerType} failed to collect.");
 		}
 	}
 }
\ No newline at end of file