{"record":{"id":"6c4f51213928d73f","repo":"NickeManarin/ScreenToGif","slug":"windows-8-or-newer-is-required-for-capturing-the-s-6c4f51","errorCode":null,"errorMessage":"Windows 8 or newer is required for capturing the screen using the Desktop Duplication API.","messagePattern":"Windows 8 or newer is required for capturing the screen using the Desktop Duplication API\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"ScreenToGif/Windows/Recorder.xaml.cs","lineNumber":1529,"sourceCode":"    }\n\n    private async Task PrepareCapture(bool isNew = true)\n    {\n        if (isNew && Capture != null)\n        {\n            await Capture.DisposeAsync();\n            Capture = null;\n        }\n\n        //If the capture helper was initialized already, ignore this.\n        if (Capture != null)\n            return;\n\n        if (UserSettings.All.UseDesktopDuplication)\n        {\n            //Check if Windows 8 or newer.\n            if (!OperationalSystemHelper.IsWin8OrHigher())\n                throw new Exception(LocalizationHelper.Get(\"S.Recorder.Warning.Windows8\"));\n\n            Capture = GetDirectCapture();\n            Capture.DeviceName = _viewModel.CurrentMonitor.Name;\n            _viewModel.IsDirectMode = true;\n        }\n        else\n        {\n            //Capture with BitBlt.\n            Capture = UserSettings.All.UseMemoryCache ? new CachedCapture() : new ImageCapture();\n            _viewModel.IsDirectMode = true;\n        }\n\n        Capture.OnError += exception =>\n        {\n            Dispatcher?.Invoke(() =>\n            {\n                //Pause the recording and show the error.\n                Pause();","sourceCodeStart":1511,"sourceCodeEnd":1547,"githubUrl":"https://github.com/NickeManarin/ScreenToGif/blob/a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd/ScreenToGif/Windows/Recorder.xaml.cs#L1511-L1547","documentation":"Thrown by PrepareCapture when the user has enabled 'Use desktop duplication' (UserSettings.All.UseDesktopDuplication) but OperationalSystemHelper.IsWin8OrHigher() returns false. IsWin8OrHigher checks Environment.OSVersion.Platform == Win32NT && Version >= 6.2.9200. The Desktop Duplication API (DXGI IDXGIOutputDuplication) only exists on Windows 8 and later, so older OSes cannot use that backend and must fall back to BitBlt capture.","triggerScenarios":"UserSettings.All.UseDesktopDuplication == true and the process is running on Windows 7 (or an OS reporting a version below 6.2.9200 via Environment.OSVersion). PrepareCapture is called when starting a recording, so the throw fires at the moment the recorder tries to initialize the DXGI direct-capture backend.","commonSituations":"Running ScreenToGif on Windows 7 (the last version without IDXGIOutputDuplication) with the Desktop Duplication option enabled; running under an app-compatibility shim or manifest that causes Environment.OSVersion to report a downgraded version; a compatibility layer (Wine) reporting a non-Win32NT platform; the setting was toggled on a newer machine and synced/carried to an older one.","solutions":["Turn off 'Use desktop duplication' in Settings > Extras so PrepareCapture uses the BitBlt path (ImageCapture/CachedCapture), which works on Windows 7.","Upgrade the OS to Windows 8/10/11 where Desktop Duplication is available.","If the OS really is Win8+ but reports wrong, check the app.manifest <compatibility> section declares Windows 8/10 GUIDs so Environment.OSVersion reports correctly.","Catch the exception in PrepareCapture's caller and automatically disable UseDesktopDuplication + retry with BitBlt instead of surfacing a hard failure."],"exampleFix":"// before\nif (UserSettings.All.UseDesktopDuplication)\n{\n    if (!OperationalSystemHelper.IsWin8OrHigher())\n        throw new Exception(LocalizationHelper.Get(\"S.Recorder.Warning.Windows8\"));\n    Capture = GetDirectCapture();\n}\n\n// after: auto-fallback to BitBlt with a logged warning instead of throwing\nif (UserSettings.All.UseDesktopDuplication)\n{\n    if (!OperationalSystemHelper.IsWin8OrHigher())\n    {\n        LogWriter.Log(\"Desktop Duplication requires Windows 8+. Falling back to BitBlt capture.\");\n        UserSettings.All.UseDesktopDuplication = false;\n    }\n    else\n    {\n        Capture = GetDirectCapture();\n        Capture.DeviceName = _viewModel.CurrentMonitor.Name;\n        _viewModel.IsDirectMode = true;\n        return;\n    }\n}\n\nif (Capture == null)\n{\n    Capture = UserSettings.All.UseMemoryCache ? new CachedCapture() : new ImageCapture();\n    _viewModel.IsDirectMode = true;\n}","handlingStrategy":"validation","validationCode":"// Validate OS support for Desktop Duplication BEFORE starting the recorder.\nif (UserSettings.All.UseDesktopDuplication && !OperationalSystemHelper.IsWin8OrHigher())\n{\n    // Auto-downgrade to BitBlt instead of letting PrepareCapture throw.\n    UserSettings.All.UseDesktopDuplication = false;\n    LogWriter.Log(\"Desktop Duplication unsupported on this OS; switched to BitBlt.\");\n}","typeGuard":"// Type/narrowing guard for the capture backend selection.\nstatic bool SupportsDesktopDuplication() =>\n    OperationalSystemHelper.IsWin8OrHigher();\n\nif (UserSettings.All.UseDesktopDuplication && !SupportsDesktopDuplication())\n    UserSettings.All.UseDesktopDuplication = false;","tryCatchPattern":"try\n{\n    await PrepareCapture();\n}\ncatch (Exception e) when (e.Message == LocalizationHelper.Get(\"S.Recorder.Warning.Windows8\"))\n{\n    // Auto-recover: disable Desktop Duplication and retry on BitBlt.\n    UserSettings.All.UseDesktopDuplication = false;\n    LogWriter.Log(e, \"Desktop Duplication unavailable; retrying with BitBlt.\");\n    await PrepareCapture();\n}","preventionTips":["Surface the Desktop Duplication toggle only on Win8+ in the settings UI.","Persist UseDesktopDuplication per-machine, not per-user-roamed, to avoid carrying it to an unsupported OS.","Ensure app.manifest declares Windows 8/10/11 compatibility GUIDs so Environment.OSVersion reports truthfully.","Unit-test IsWin8OrHigher against known version tuples."],"tags":["desktop-duplication","dxgi","os-version","windows-7","settings","compatibility"],"backgroundTag":null,"analyzedSha":"a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd","analyzedAt":"2026-08-13T11:12:06.147Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}