NickeManarin/ScreenToGif · error · Exception
Could not find the specified output device.
Error message
Could not find the specified output device.
What it means
The catch(SharpDXException) in GetOutput wraps any DirectX/DXGI failure raised while enumerating Adapters1/Outputs or calling output.QueryInterface<Output1>(). Unlike error 20 (no output found at all), this fires when DXGI itself throws — the adapter or output exists structurally but the call into it failed.
Source
Thrown at ScreenToGif/Capture/DirectImageCapture.cs:262
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
Format = Format.B8G8R8A8_UNorm,
Width = Height,
Height = Width,
OptionFlags = ResourceOptionFlags.None,
MipLevels = 1,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Default
});
}
//Create textures in here, after detecting the orientation?
return output.QueryInterface<Output1>();
}
catch (SharpDXException ex)
{
throw new Exception("Could not find the specified output device.", ex);
}
}
public override int Capture(FrameInfo frame)
{
var res = new Result(-1);
try
{
//Try to get the duplicated output frame within given time.
res = DuplicatedOutput.TryAcquireNextFrame(0, out var info, out var resource);
if (FrameCount == 0 && (res.Failure || resource == null))
{
//Somehow, it was not possible to retrieve the resource, frame or metadata.
resource?.Dispose();
return FrameCount;View on GitHub (pinned to a4d0a67c21)
Solutions
- Restart the recorder after the GPU driver stabilises; this is usually transient after a TDR.
- Update the GPU driver to the latest vendor release (Intel/NVIDIA/AMD).
- If it reproduces persistently, switch off 'Use Desktop Duplication API' to use BitBlt capture instead.
- Check the inner SharpDXException.Descriptor.NativeApiCode in logs to identify the exact DXGI error and act on it.
Example fix
// before
catch (SharpDXException ex)
{
throw new Exception("Could not find the specified output device.", ex);
}
// after
catch (SharpDXException ex) when (ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceRemoved)
{
throw new GraphicsConfigurationException("GPU device was removed during output enumeration.", ex);
}
catch (SharpDXException ex)
{
throw new Exception($"Could not find the specified output device. {ex.Descriptor.NativeApiCode}", ex);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Validate adapter health before enumeration
try
{
using var factory = new Factory1();
var healthy = factory.Adapters1.All(a => a.Description.Description != null);
if (!healthy) { /* defer capture, retry after GPU reset */ }
}
catch (SharpDXException) { /* GPU not ready */ } Type guard
catch (SharpDXException ex) when (ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceRemoved || ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceHung) { /* TDR — retry once after delay */ } Try / catch
try { return output.QueryInterface<Output1>(); }
catch (SharpDXException ex) when (ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceRemoved)
{
LogWriter.Log(ex, "DXGI device removed during output enumeration");
throw new GraphicsConfigurationException("GPU device removed. Restart the recorder.", ex);
}
catch (SharpDXException ex)
{
throw new Exception($"Could not find the specified output device. {ex.Descriptor.NativeApiCode}", ex);
} Prevention
- Keep GPU drivers current; TDRs are the most common source.
- On device-removed, dispose the Factory and rebuild from scratch rather than reusing stale adapters.
- Avoid toggling the display adapter while the recorder is active.
When it happens
Trigger: output.QueryInterface<Output1>() raises a SharpDXException (e.g. DXGI_ERROR_DEVICE_REMOVED, access denied, driver-recreated swap chain), or enumerating factory.Adapters1/Outputs throws because the DXGI device was torn down.
Common situations: GPU driver crashed or was reset during enumeration (TDR / device-removed); the display adapter was disabled while the recorder was starting; running under a WDDM reset; security software blocking DXGI access; hybrid-GPU switching mid-call.
Related errors
- Could not find a proper output device for the area of L: {Le
- Too many applications using the Desktop Duplication API. Ple
- The Desktop Duplication API is not supported on this compute
- The Desktop Duplication API is not supported on this screen.
- Looks like that the Desktop Duplication API is not supported
AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13).
Data as JSON: /api/errors/4af305889de13e7b.
Report an issue: GitHub.