diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs
index 916fa9c5..fed3d8e3 100644
--- a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs
+++ b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs
@@ -8,27 +8,6 @@ namespace ComputeSharp.Core.Extensions;
///
internal static class ComPtrExtensions
{
- ///
- /// Reinterprets the current instance as one of type .
- ///
- /// The type of the current instance.
- /// The input instance to upcast.
- /// A instance of type .
- ///
- /// This method is meant to be used in a chained expression and it does not increment the reference
- /// count for the input pointer. Do not expose the return value of this extension to consumers.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe ref readonly ComPtr AsIUnknown(this in ComPtr ptr)
-#if NET6_0_OR_GREATER
- where T : unmanaged, IUnknown.Interface
-#else
- where T : unmanaged
-#endif
- {
- return ref Unsafe.As, ComPtr>(ref Unsafe.AsRef(in ptr));
- }
-
///
/// Moves the current instance and resets it without releasing the reference.
///
diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs
index df41949f..06974338 100644
--- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs
+++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs
@@ -137,7 +137,7 @@ partial class DeviceHelper
dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert();
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
- dxgiAdapter1.AsIUnknown().Get(),
+ (IUnknown*)dxgiAdapter1.Get(),
D3D_FEATURE_LEVEL_11_0,
Windows.__uuidof(),
null);
@@ -148,7 +148,7 @@ partial class DeviceHelper
using ComPtr d3D12Device = default;
DirectX.D3D12CreateDevice(
- dxgiAdapter1.AsIUnknown().Get(),
+ (IUnknown*)dxgiAdapter1.Get(),
D3D_FEATURE_LEVEL_11_0,
Windows.__uuidof(),
(void**)d3D12Device.GetAddressOf()).Assert();
@@ -178,7 +178,7 @@ partial class DeviceHelper
}
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
- dxgiAdapter1.AsIUnknown().Get(),
+ (IUnknown*)dxgiAdapter1.Get(),
D3D_FEATURE_LEVEL_11_0,
Windows.__uuidof(),
null);
@@ -189,7 +189,7 @@ partial class DeviceHelper
using ComPtr d3D12Device = default;
DirectX.D3D12CreateDevice(
- dxgiAdapter1.AsIUnknown().Get(),
+ (IUnknown*)dxgiAdapter1.Get(),
D3D_FEATURE_LEVEL_11_0,
Windows.__uuidof(),
(void**)d3D12Device.GetAddressOf()).Assert();
diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs
index 2bd3540e..c97e1b76 100644
--- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs
+++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs
@@ -98,7 +98,7 @@ internal static partial class DeviceHelper
// 3) The call fails for other reasons. In this case the adapter is simply skipped.
// This might be the case if an adapter doesn't support the requested feature level.
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
- dxgiAdapter1.AsIUnknown().Get(),
+ (IUnknown*)dxgiAdapter1.Get(),
D3D_FEATURE_LEVEL_11_0,
Windows.__uuidof(),
(void**)d3D12DeviceCandidate.GetAddressOf());
@@ -142,7 +142,7 @@ internal static partial class DeviceHelper
using ComPtr d3D12DeviceCandidate = default;
HRESULT createDeviceResult = DirectX.D3D12CreateDevice(
- dxgiAdapter1.AsIUnknown().Get(),
+ (IUnknown*)dxgiAdapter1.Get(),
D3D_FEATURE_LEVEL_11_0,
Windows.__uuidof(),
(void**)d3D12DeviceCandidate.GetAddressOf());