{"record":{"id":"52b390d6090d958b","repo":"NickeManarin/ScreenToGif","slug":"impossible-to-capture-the-manual-screenshot","errorCode":null,"errorMessage":"Impossible to capture the manual screenshot.","messagePattern":"Impossible to capture the manual screenshot\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"ScreenToGif/Windows/NewRecorder.xaml.cs","lineNumber":1194,"sourceCode":"            catch (Exception ex)\n            {\n                LogWriter.Log(ex, \"Impossible to start the screencasting.\");\n                ErrorDialog.Ok(Title, LocalizationHelper.Get(\"S.Recorder.Warning.CaptureNotPossible\"), ex.Message, ex);\n                return;\n            }\n        }\n\n        #region Take the screenshot\n\n        try\n        {\n            var limit = 0;\n            do\n            {\n                FrameCount = await Capture.ManualCaptureAsync(new FrameInfo(RecordClicked, KeyList), UserSettings.All.ShowCursor);\n\n                if (limit > 5)\n                    throw new Exception(\"Impossible to capture the manual screenshot.\");\n\n                limit++;\n            }\n            while (FrameCount == 0);\n\n            KeyList.Clear();\n\n            //Displays that a frame was manually captured.\n            DisplayTimer.ManuallyCapturedCount++;\n            CommandManager.InvalidateRequerySuggested();\n        }\n        catch (GraphicsConfigurationException g)\n        {\n            IsRecording = false;\n\n            LogWriter.Log(g, \"Impossible to take a snap due to wrong graphics adapter.\");\n            GraphicsConfigurationDialog.Ok(g, _viewModel.CurrentMonitor);\n        }","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/NickeManarin/ScreenToGif/blob/a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd/ScreenToGif/Windows/NewRecorder.xaml.cs#L1176-L1212","documentation":"NewRecorder's manual-capture snapshot loop calls Capture.ManualCaptureAsync repeatedly until FrameCount > 0, with a hard retry cap. After limit exceeds 5 (six failed attempts) it throws — the capture backend persistently returned zero frames.","triggerScenarios":"Capture.ManualCaptureAsync returns FrameCount == 0 on six consecutive calls. Causes: the capture source (DDU or BitBlt) yielded no frame each time, e.g. desktop not composited, screen locked, capture surface unavailable, DXGI AcquireNextFrame returning empty.","commonSituations":"Screen locked or UAC secure-desktop active during the snap; full-screen exclusive application blocking BitBlt/DDU; graphics adapter issue; capture backend misconfigured; high-DPI/rotation path returning zero; antivirus hooking the capture surface.","solutions":["Make sure the desktop is unlocked and not on the secure desktop (UAC prompt) when snapping.","Toggle 'Use Desktop Duplication API' off (or on) in Options > Capture to switch the backend.","Update the GPU driver.","Close full-screen exclusive applications before capturing."],"exampleFix":"// before\nvar limit = 0;\ndo\n{\n    FrameCount = await Capture.ManualCaptureAsync(new FrameInfo(RecordClicked, KeyList), UserSettings.All.ShowCursor);\n    if (limit > 5)\n        throw new Exception(\"Impossible to capture the manual screenshot.\");\n    limit++;\n}\nwhile (FrameCount == 0);\n\n// after\nvar limit = 0;\ndo\n{\n    FrameCount = await Capture.ManualCaptureAsync(new FrameInfo(RecordClicked, KeyList), UserSettings.All.ShowCursor);\n    if (limit > 5)\n        throw new Exception(\"Impossible to capture the manual screenshot. The capture backend returned no frame after 6 attempts. Unlock the desktop or switch capture mode.\");\n    limit++;\n}\nwhile (FrameCount == 0);","handlingStrategy":"retry","validationCode":"// Check capture surface availability before the loop\nif (Capture == null || !await Capture.IsAvailableAsync()) /* warn user */","typeGuard":"// n/a","tryCatchPattern":"try { /* manual capture loop */ }\ncatch (GraphicsConfigurationException g) { GraphicsConfigurationDialog.Ok(g, _viewModel.CurrentMonitor); }\ncatch (Exception e) { ErrorDialog.Ok(Title, ...); }","preventionTips":["Confirm the desktop is unlocked and not on the secure desktop before snapping.","Offer to switch capture backend (DDU <-> BitBlt) when retries repeatedly fail.","Surface a clearer message after the retry cap is hit, including the capture mode."],"tags":["capture","manual-snapshot","recorder","retry-exhausted"],"backgroundTag":null,"analyzedSha":"a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd","analyzedAt":"2026-08-13T11:12:06.147Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}