Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/Controls/tests/Core.UnitTests/TestClasses/TestWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.Maui.Controls.Core.UnitTests
{
public class TestWindow : Window
{
// Because the relationship from Window => Application is a weakreference
// we need to retain a reference to the Application so it doesn't get GC'd
TestApp _app;
public TestWindow()
{

Expand All @@ -24,12 +25,10 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName
if (propertyName == PageProperty.PropertyName &&
Parent == null)
{
var app = new TestApp(this);
_ = (app as IApplication).CreateWindow(null);
_app = new TestApp(this);
_ = (_app as IApplication).CreateWindow(null);
}
}


}

public static class TestWindowExtensions
Expand Down