diff --git a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs index c2ec6e2c..113429b1 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs @@ -1,4 +1,5 @@ -using ComputeSharp.Interop; +using System; +using ComputeSharp.Interop; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -58,6 +59,20 @@ public class DeviceDisposalTests Assert.AreEqual(refCount, 1u); } + [CombinatorialTestMethod] + [AllDevices] + [ExpectedException(typeof(ObjectDisposedException))] + public unsafe void DeviceDisposal_InteropServicesThrowsObjectDisposedException(Device device) + { + using ComPtr d3D12Device = default; + + GraphicsDevice graphicsDevice = device.Get(); + + graphicsDevice.Dispose(); + + InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof(), (void**)d3D12Device.GetAddressOf()); + } + [CombinatorialTestMethod] [AllDevices] public unsafe void DeviceDisposal_DisposedResources_ReferenceCounting(Device device)