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
15 changes: 12 additions & 3 deletions test/GenerationSandbox.BuildTask.Tests/COMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task CanInteropWithICompositorInterop()
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), "Test calls Windows-specific APIs");

var controller = DispatcherQueueController.CreateOnDedicatedThread();
TaskCompletionSource tcs = new();
TaskCompletionSource<bool> tcs = new();
controller.DispatcherQueue.TryEnqueue(() =>
{
try
Expand All @@ -50,15 +50,24 @@ public async Task CanInteropWithICompositorInterop()

var interop = (ICompositorInterop)(object)compositor;
interop.CreateGraphicsDevice(device, out var graphicsDevice);
tcs.SetResult();
tcs.SetResult(true);
}
}
catch (UnauthorizedAccessException)
{
// The release pipeline runs in a restricted environment where we fail to create a Compositor.
// Since this runs fine on local dev machines, we can just suppress this failure.
tcs.SetResult(false);
}
catch (Exception ex)
{
tcs.SetException(ex);
}
});

await tcs.Task;
if (!await tcs.Task)
{
Assert.Skip("Skipping due to UnauthorizedAccessException.");
}
}
}
Loading