Skip to content

Commit 1f1fc73

Browse files
Fix issue in VisualUITestBase if a test does not call SetTestContentAsync within the test.
Add guard against NRE with App.ContentRoot being null
1 parent baf8adb commit 1f1fc73

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

UnitTests/UnitTests.UWP/VisualUITestBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ public async Task Cleanup()
6464

6565
await App.DispatcherQueue.EnqueueAsync(() =>
6666
{
67+
// If we didn't set our content we don't have to do anything but complete here.
68+
if (App.ContentRoot is null)
69+
{
70+
taskCompletionSource.SetResult(true);
71+
return;
72+
}
73+
6774
// Going to wait for our original content to unload
6875
App.ContentRoot.Unloaded += (_, _) => taskCompletionSource.SetResult(true);
6976

0 commit comments

Comments
 (0)