NickeManarin/ScreenToGif · error · Exception

Impossible to capture the manual screenshot.

Error message

Impossible to capture the manual screenshot.

What it means

Thrown by the Recorder when ManualCaptureAsync repeatedly returns zero captured frames. The code loops calling Capture.ManualCaptureAsync up to ~6 times (limit 0..5) while FrameCount stays 0; once the retry budget is exhausted the generic Exception is raised. It is a safety valve for a capture pipeline (Desktop Duplication or BitBlt) that is alive but producing no usable bitmap frames.

Source

Thrown at ScreenToGif/Windows/Recorder.xaml.cs:1003

            catch (Exception ex)
            {
                LogWriter.Log(ex, "Impossible to start the screencasting.");
                ErrorDialog.Ok(Title, LocalizationHelper.Get("S.Recorder.Warning.CaptureNotPossible"), ex.Message, ex);
                return;
            }
        }

        #region Take the screenshot

        try
        {
            var limit = 0;
            do
            {
                FrameCount = await Capture.ManualCaptureAsync(new FrameInfo(RecordClicked, KeyList), UserSettings.All.ShowCursor);

                if (limit > 5)
                    throw new Exception("Impossible to capture the manual screenshot.");

                limit++;
            }
            while (FrameCount == 0);

            KeyList.Clear();

            DisplayTimer.ManuallyCapturedCount++;
            CommandManager.InvalidateRequerySuggested();
        }
        catch (GraphicsConfigurationException g)
        {
            IsRecording = false;

            LogWriter.Log(g, "Impossible to start the recording due to wrong graphics adapter.");
            GraphicsConfigurationDialog.Ok(g, _viewModel.CurrentMonitor);
        }
        catch (Exception e)

View on GitHub (pinned to a4d0a67c21)

Solutions

  1. Switch the capture backend: turn off 'Use desktop duplication' in Settings > Extras so the recorder falls back to BitBlt (ImageCapture/CachedCapture) in PrepareCapture.
  2. Wake all displays / reopen the laptop lid and reselect the target monitor in the recorder, then retry — a disconnected or sleeping monitor yields zero frames from DXGI.
  3. Stop recording exclusive-fullscreen apps or borderless-window apps that block desktop capture; run the target window in windowed mode.
  4. Update or roll back the graphics driver — a TDR/driver crash leaves the Desktop Duplication output returning empty frames.
  5. If on RDP, enable RemoteFX/stable virtual GPU, or record on the physical host instead — headless/limited RDP sessions cannot produce Desktop Duplication frames.
  6. Increase the retry budget or add a small delay between ManualCaptureAsync attempts so a transient GPU stall can clear.

Example fix

// before
var limit = 0;
do
{
    FrameCount = await Capture.ManualCaptureAsync(new FrameInfo(RecordClicked, KeyList), UserSettings.All.ShowCursor);
    if (limit > 5)
        throw new Exception("Impossible to capture the manual screenshot.");
    limit++;
}
while (FrameCount == 0);

// after: bounded retries with backoff + clear cause before giving up
var limit = 0;
do
{
    FrameCount = await Capture.ManualCaptureAsync(new FrameInfo(RecordClicked, KeyList), UserSettings.All.ShowCursor);
    if (FrameCount == 0)
    {
        if (++limit > 10)
            throw new CaptureEmptyFrameException("Manual capture returned no frame after retries. Backend: " + Capture.GetType().Name);
        await Task.Delay(50);
    }
}
while (FrameCount == 0);
Defensive patterns

Strategy: retry

Validate before calling

// Before starting manual capture, confirm the backend can produce a frame.
if (Capture == null)
    throw new InvalidOperationException("Capture backend not initialized.");

if (_viewModel?.CurrentMonitor == null || _viewModel.Monitors.Count == 0)
    throw new InvalidOperationException("No target monitor selected for capture.");

// Optional: verify the target monitor is still powered/connected.
var alive = MonitorHelper.AllMonitors.Any(m => m.DeviceName == Capture.DeviceName);
if (!alive)
    throw new InvalidOperationException("Target monitor no longer available.");

Type guard

// Narrow the capture backend so retry/backoff policy is backend-aware.
static bool IsDirectCapture(ICapture capture) => capture is DirectCapture;

if (IsDirectCapture(Capture))
{
    // DXGI: longer backoff, fewer retries (GPU stall clears slowly).
}

Try / catch

// Catch the retry-exhausted state separately from GraphicsConfigurationException.
try
{
    // ... capture loop ...
}
catch (GraphicsConfigurationException g)
{
    IsRecording = false;
    LogWriter.Log(g, "Wrong graphics adapter for capture.");
    GraphicsConfigurationDialog.Ok(g, _viewModel.CurrentMonitor);
}
catch (Exception e) when (e.Message.Contains("manual screenshot"))
{
    IsRecording = false;
    LogWriter.Log(e, "Manual capture retries exhausted.");
    // Offer the user a backend switch instead of a hard stop.
    if (UserSettings.All.UseDesktopDuplication)
        ErrorDialog.Ok(Title, "Capture failed", "Disable Desktop Duplication in Settings and retry.", e);
}

Prevention

When it happens

Trigger: The user triggers a manual-capture frame (CaptureFrequencies.Manual) and Capture.ManualCaptureAsync() returns 0 every iteration for more than 5 attempts. This happens when the underlying capture device returns an empty/stale frame texture (Desktop Duplication mode) or BitBlt yields an empty region (ImageCapture/CachedCapture), e.g. the recorded monitor is asleep, GPU reset, exclusive-fullscreen app, or RDP session without desktop composition.

Common situations: Recording on a monitor that went to sleep / powered off mid-session; a laptop lid closed (display disconnected); running inside an RDP/virtual display session where DXGI Desktop Duplication has no AcquireNextFrame; a driver crash or TDR resetting the GPU; recording a fullscreen DirectX/Vulkan game that blocks BitBlt; DPI/credential (UAC prompt on secure desktop) screens blocking capture.

Related errors


AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13). Data as JSON: /api/errors/836e097b808d500d. Report an issue: GitHub.