{"record":{"id":"fd90260b1089f238","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"deploymentresult-errortext","errorCode":null,"errorMessage":"{deploymentResult.ErrorText}","messagePattern":"\\{deploymentResult\\.ErrorText\\}","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"source/StoreAppHelper/AppManager.cs","lineNumber":44,"sourceCode":"            var packageManager = new PackageManager();\r\n\r\n            var deploymentOperation = packageManager.RemovePackageAsync(fullName);\r\n\r\n            var opCompletedEvent = new ManualResetEvent(false);\r\n            deploymentOperation.Completed += (info, status) => opCompletedEvent.Set();\r\n\r\n            Console.WriteLine($\"Uninstalling \\\"{fullName}\\\"\");\r\n\r\n            opCompletedEvent.WaitOne();\r\n\r\n            // Check the status of the operation\r\n            switch (deploymentOperation.Status)\r\n            {\r\n                case AsyncStatus.Error:\r\n                    var deploymentResult = deploymentOperation.GetResults();\r\n                    Console.WriteLine(@\"Error code: {0}\", deploymentOperation.ErrorCode);\r\n                    Console.WriteLine(@\"Error text: {0}\", deploymentResult.ErrorText);\r\n                    throw new IOException(deploymentResult.ErrorText);\r\n\r\n                case AsyncStatus.Canceled:\r\n                    Console.WriteLine(@\"Uninstallation was cancelled\");\r\n                    throw new OperationCanceledException();\r\n\r\n                case AsyncStatus.Completed:\r\n                    Console.WriteLine(@\"Uninstallation completed successfully\");\r\n                    return;\r\n\r\n                default:\r\n                    Console.WriteLine(@\"Invalid status: {0}\", deploymentOperation.Status);\r\n                    throw new IOException();\r\n            }\r\n        }\r\n\r\n        public static IEnumerable<App> QueryApps()\r\n        {\r\n            var packageManager = new PackageManager();\r","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/StoreAppHelper/AppManager.cs#L26-L62","documentation":"An IOException thrown by `AppManager.UninstallApp` when a `PackageManager.RemovePackageAsync` operation completes with `AsyncStatus.Error`. The exception message is the raw `DeploymentResult.ErrorText` returned by the Windows deployment stack, which typically describes why the package could not be removed (permissions, package in use, not found, policy). The original `ErrorCode` is printed to console but not wrapped into the exception.","triggerScenarios":"Uninstalling a Store/MSIX package that is currently running, owned by another user, protected by policy, already removed, or whose full package name is malformed/incorrect.","commonSituations":"Passing a partial or wrong package family name; app still running in the background; system/protected package that cannot be user-uninstalled; package installed for a different user account.","solutions":["Ensure the app is fully closed before uninstalling (check Task Manager).","Pass the exact full package name (e.g. from `AppManager.QueryApps()` output).","Run the operation with sufficient privileges; some packages require administrator.","Read the printed Error code/Error text to identify the specific Win32 deployment failure."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate the package exists and is removable before uninstalling.\nvar existing = AppManager.QueryApps().FirstOrDefault(a => a.Id.FullName == fullName);\nif (existing == null) throw new InvalidOperationException($\"Package {fullName} not found.\");","typeGuard":null,"tryCatchPattern":"try { AppManager.UninstallApp(fullName); }\ncatch (IOException ex)\n{\n    // ex.Message is the DeploymentResult.ErrorText\n    if (ex.Message.Contains(\"deployment\") || ex.Message.Contains(\"in use\"))\n        /* prompt user to close the app and retry */\n}","preventionTips":["Use the exact full package name returned by QueryApps().","Ensure the app is not running before uninstalling.","Inspect the printed Error code/Error text to diagnose specific failures.","Run with sufficient privileges for protected packages."],"tags":["uwp","msix","storeapp","windows","storeapphelper"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}