From 91722437c43e2dd47c0d4104a132740f8a8f93cf Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Aug 2022 00:13:09 +0200 Subject: [PATCH] Fix GC hole in device lost unit tests --- .../Helpers/GraphicsDeviceHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs b/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs index 39a13cd0..8160a5fa 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs @@ -21,7 +21,10 @@ internal static class GraphicsDeviceHelper /// The underlying object for . public static unsafe void GetD3D12Device(GraphicsDevice graphicsDevice, in ComPtr d3D12Device) { - InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof(), (void**)d3D12Device.GetAddressOf()); + fixed (ID3D12Device** ppvObject = d3D12Device) + { + InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof(), (void**)ppvObject); + } } ///