{"record":{"id":"88281ea94fae6d5e","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"error-while-collecting-windows-features-if-window","errorCode":null,"errorMessage":"Error while collecting Windows Features. If Windows Update is running wait until it finishes and try again. If the error persists try restarting your computer. In case nothing helps, read the KB957310 article.","messagePattern":"Error while collecting Windows Features\\. If Windows Update is running wait until it finishes and try again\\. If the error persists try restarting your computer\\. In case nothing helps, read the KB957310 article\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"source/UninstallTools/Factory/WindowsFeatureFactory.cs","lineNumber":44,"sourceCode":"            var t = new Thread(() =>\r\n            {\r\n                try\r\n                {\r\n                    results.AddRange(WmiQueries.GetWindowsFeatures()\r\n                        .Where(x => x.Enabled)\r\n                        .Select(WindowsFeatureToUninstallerEntry));\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    error = ex;\r\n                }\r\n            });\r\n            t.Start();\r\n\r\n            t.Join(TimeSpan.FromSeconds(40));\r\n\r\n            if (error != null)\r\n                throw new IOException(\"Error while collecting Windows Features. If Windows Update is running wait until it finishes and try again. If the error persists try restarting your computer. In case nothing helps, read the KB957310 article.\", error);\r\n            if (t.IsAlive)\r\n            {\r\n                //t.Abort();\r\n                throw new TimeoutException(\"WMI query has hung while collecting Windows Features, try restarting your computer. If the error persists read the KB957310 article.\");\r\n            }\r\n\r\n            return results;\r\n        }\r\n\r\n        private static ApplicationUninstallerEntry WindowsFeatureToUninstallerEntry(WindowsFeatureInfo info)\r\n        {\r\n            var displayName = !string.IsNullOrEmpty(info.DisplayName) ? info.DisplayName : info.FeatureName;\r\n\r\n            return new ApplicationUninstallerEntry\r\n            {\r\n                RawDisplayName = displayName,\r\n                Comment = info.Description,\r\n                UninstallString = DismTools.GetDismUninstallString(info.FeatureName, false),\r","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/UninstallTools/Factory/WindowsFeatureFactory.cs#L26-L62","documentation":"An IOException thrown by WindowsFeatureFactory when the background thread that enumerates Windows Features via WMI/DSIM throws an exception. The factory runs the feature query on a separate thread and joins for up to 40 seconds; if the thread captured an exception (stored in `error`), it is wrapped into this IOException with a message guiding the user to wait for Windows Update, restart, or consult KB957310.","triggerScenarios":"WMI service (winmgmt) is malfunctioning, the DISM/Features provider is unavailable, Windows Update is actively locking the servicing stack, or the CBS store is corrupt — any of these causes the feature-enumeration API to throw inside the worker thread.","commonSituations":"Windows Update running in the background; corrupted component store (CBS); WMI service stopped or corrupted; recently failed Windows update leaving the servicing stack busy; group policy restricting WMI access.","solutions":["Wait for any running Windows Update to finish, then retry.","Restart the computer to clear transient servicing-stack locks.","Run `sfc /scannow` and `DISM /Online /Cleanup-Image /RestoreHealth` to repair the component store.","Ensure the WMI service (winmgmt) is running; restart it if needed.","Consult KB957310 for advanced troubleshooting of the Windows Features tooling."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Quick health check: is WMI available before enumerating features?\nusing (var searcher = new System.Management.ManagementObjectSearcher(\"SELECT * FROM Win32_OperatingSystem\"))\n{\n    try { searcher.Get().Count.ToString(); } catch { /* WMI unavailable; skip features */ }\n}","typeGuard":null,"tryCatchPattern":"try { var features = WindowsFeatureFactory.GetFeatures(); }\ncatch (IOException ex) when (ex.Message.Contains(\"Error while collecting Windows Features\"))\n{ /* warn user, optionally retry after WU completes or skip feature list */ }","preventionTips":["Detect whether Windows Update is running and defer feature collection.","Verify the WMI service is healthy before querying features.","Run sfc/DISM RestoreHealth periodically to keep the CBS store valid.","Make feature collection optional so a failure does not break the whole app."],"tags":["wmi","windows-features","dism","servicing","environment","uninstalltools"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}