{"record":{"id":"e9516c8d402f8f16","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"failed-to-open-control-panel-entry","errorCode":null,"errorMessage":"Failed to open control panel entry","messagePattern":"Failed to open control panel entry","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"source/KlocTools/Tools/WindowsTools.cs","lineNumber":463,"sourceCode":"\n                return true;\n            }\n            return false;\n        }\n\n        /// <summary>\n        ///     Open target control panel applet and return immidiately.\n        /// </summary>\n        /// <exception cref=\"IOException\">Failed to open control panel entry</exception>\n        public static void OpenControlPanelApplet(ControlPanelCanonicalNames target)\n        {\n            try\n            {\n                new ProcessStartInfo(CplPath, \"/name Microsoft.\" + target) { UseShellExecute = true }.Start();\n            }\n            catch (Exception ex)\n            {\n                throw new IOException(\"Failed to open control panel entry\", ex);\n            }\n        }\n\n        /// <exception cref=\"ArgumentNullException\">The value of 'objectPath' cannot be null. </exception>\n        /// <exception cref=\"IOException\">Failed to start explorer. </exception>\n        public static void OpenExplorerFocusedOnObject(string objectPath)\n        {\n            if (objectPath == null)\n            {\n                throw new ArgumentNullException(nameof(objectPath));\n            }\n            try\n            {\n                new ProcessStartInfo(\"explorer.exe\", string.Format(\"/select,\\\"{0}\\\"\", objectPath)).Start();\n            }\n            catch (ArgumentNullException)\n            {\n                throw;","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/KlocTools/Tools/WindowsTools.cs#L445-L481","documentation":"Thrown by OpenControlPanelApplet as a catch-all when starting the control panel executable (CplPath with /name Microsoft.<target>) fails for any reason. The original exception is preserved as InnerException. The helper uses UseShellExecute=true, so failures typically come from the shell association, the canonical name, or policy.","triggerScenarios":"Passing a ControlPanelCanonicalNames value that does not map to an installed applet; CplPath being unset or pointing at a missing control.exe; group policy disabling the item; shell associations broken so UseShellExecute cannot resolve the .cpl/.exe.","commonSituations":"Opening an applet not present on the Windows edition (e.g. an older applet on Windows 11); stripped-down images without control.exe; corporate policy 'Hide specified Control Panel items'; user-changed file associations for .cpl.","solutions":["Catch the IOException and inspect InnerException (often Win32Exception with a native error code) to pinpoint the cause.","Confirm the target canonical name is valid for the running Windows edition.","Verify control.exe is reachable (CplPath) and not blocked by policy.","On Server Core or LTSC without the Control Panel, offer an alternate settings deep-link instead."],"exampleFix":"// before\nWindowsTools.OpenControlPanelApplet(target);\n\n// after\ntry { WindowsTools.OpenControlPanelApplet(target); }\ncatch (IOException ex)\n{\n    Log.Error($\"Could not open {target}\", ex.InnerException ?? ex);\n    Process.Start(\"ms-settings:\");\n}","handlingStrategy":"try-catch","validationCode":"if (!File.Exists(WindowsTools.CplPath))\n    return; // control.exe missing; do not attempt","typeGuard":null,"tryCatchPattern":"try { WindowsTools.OpenControlPanelApplet(target); }\ncatch (IOException ex)\n{\n    var root = ex.InnerException ?? ex;\n    Log.Error($\"Could not open {target}: {root.Message}\");\n}","preventionTips":["Confirm the canonical name exists on the running Windows edition.","Verify control.exe is reachable and not policy-blocked.","Offer an ms-settings: deep-link as a fallback on editions without the Control Panel."],"tags":["windows","control-panel","process","error-wrapping","csharp"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}