stride3d/stride · warning · NotSupportedException

The specified COM pointer type is not supported.

Error message

The specified COM pointer type is not supported.

What it means

DebugHelpers<T>.SetDebugName casts the raw COM pointer to a known D3D debug interface (ID3D11DeviceChild / ID3D12DeviceChild) and throws NotSupportedException in the default branch when the COM pointer's type is none of the supported Direct3D interfaces. It exists so objects can be tagged for graphics debuggers (PIX, Visual Studio Graphics Diagnostics). Stride only supports a fixed set of native types for naming.

Solutions

  1. Only call SetDebugName with supported D3D11/D3D12 device-child objects (buffers, textures, shaders, etc.)
  2. Extend the switch in DebugHelpers.Direct3D.cs to QueryInterface and cast the new COM type (e.g. IDXGISwapChain) before setting its name
  3. Wrap the call in a check for the concrete interface type and skip naming for unsupported objects
  4. Update Stride to a version where the object type you are naming is supported

Example fix

// before
DebugHelpers.SetDebugName(swapChainNativePtr, "MySwapChain"); // unsupported COM type
// after
if (swapChainNativePtr is ID3D12DeviceChild deviceChild) // only name supported device children
    DebugHelpers.SetDebugName(deviceChild.NativePtr, "MySwapChain");
Defensive patterns

Strategy: try-catch

Validate before calling

// only name known-supported device children
if (obj is ID3D11DeviceChild || obj is ID3D12DeviceChild)
    DebugHelpers.SetDebugName(ptr, name);

Type guard

bool CanSetDebugName<T>(T ptr) => typeof(T) == typeof(ID3D11DeviceChild) || typeof(T) == typeof(ID3D12DeviceChild);

Try / catch

try { DebugHelpers.SetDebugName(comPtr, name); }
catch (NotSupportedException) { /* naming unsupported on this COM type; skip */ }

Prevention

When it happens

Trigger: Calling SetDebugName (directly or via GraphicsResource.Name setter on D3D11/D3D12) with a generic parameter T or COM pointer whose native interface is not among the cases handled in the switch — e.g. a swap chain, DXGI object, or a custom/newer D3D object type not covered by the implemented branches.

Common situations: Assigning .Name to a graphics resource on a backend/object combination Stride does not map (e.g. naming a DXGI factory/adapter or unsupported D3D12 object); custom engine code extending graphics objects and reusing SetDebugName with a new COM type; API-version changes where the cast target interface differs.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/9f972ab9dbc112ab. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D/DebugHelpers.Direct3D.cs:98

            case IComVtbl<ID3D11DeviceChild>:
            {
                var nameSpan = name.GetAsciiSpan();
                var nameSpanLength = (uint) nameSpan.Length;

                var d3d11DeviceChild = CastComPtr<T, ID3D11DeviceChild>(comPtr);
                d3d11DeviceChild.SetPrivateData(DebugObjectName, nameSpanLength, nameSpan);
                break;
            }
#elif STRIDE_GRAPHICS_API_DIRECT3D12
            case IComVtbl<ID3D12DeviceChild>:
            {
                var d3d12DeviceChild = CastComPtr<T, ID3D12DeviceChild>(comPtr);
                d3d12DeviceChild.SetName(name);
                break;
            }
#endif
            default:
                throw new NotSupportedException("The specified COM pointer type is not supported.");
        }

        if (LogDebugNames)
        {
            // Log the debug name for the object
            var typeName = typeof(T).Name;
            var ptr = (nint) comPtr.Handle;
            Debug.WriteLine($"Changed or set the debug name for {typeName} at 0x{ptr:X8} to '{name}'.");
        }
    }
}

#endif

View on GitHub (pinned to 96fad776d2)