Repository navigation
Fix parsing WinGet uninstall commands with dotted arguments - #1017
Open
BreezeDelegate wants to merge 2 commits into
Open
BreezeDelegate wants to merge 2 commits into
BreezeDelegate wants to merge 2 commits into
Conversation
hazeliscoding
approved these changes
Oct 21, 2026
hazeliscoding
left a comment
Collaborator
There was a problem hiding this comment.
Tested on Windows 11 x64 (build 26200), built with VS 2026 MSBuild. The WinGet case fails on master (the whole 81-character command comes back as the file name) and passes with the fix. The five existing command shapes pass both before and after. The full suite passes (61 passed, 1 skipped).
Also checked in the app with a test uninstall entry of winget uninstall --product-code <fake dotted id>: on master BCU fails with "The system cannot find the file specified". With this PR it runs winget, which returns its no-package-found code (0x8A150014).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix command parsing for uninstall strings that use a bare executable name with dotted arguments, such as:
SeparateArgsFromCommandcurrently sees the first.in the package identifier and treats the entire command line as the executable path. This makesProcess.Starttry to launch the full string as a file.The same parser failure also explains #779, which reports the equivalent command shape with
mikf.gallery-dl_Microsoft.Winget.Source_8wekyb3d8bbwe.The existing parser now gets the first chance to split valid paths and executable names. A bare-executable fallback is only used when dotted arguments otherwise leave the whole command looking like a filename. This preserves existing unquoted executable names that contain spaces.
Fixes #971.
Fixes #779.
Validation
master: the reported WinGet command is parsed as the entire executable path, reproducing the failure from Consistently fails to uninstall WinGet packages #971/Error: File doesn't exist (it does) #779ProcessTools.SeparateArgsFromCommandmatrix: 7/7 passed under a self-contained win-x64 run, covering both reported WinGet product codes,cmd,msiexec, quoted/unquoted paths with spaces, and an unquoted executable name containing spacesMy Uninstaller.exe /SasMy+Uninstaller.exe /S; the final implementation preservesMy Uninstaller.exe+/SKlocToolsRelease build: 0 warnings, 0 errorsgit diff --check: cleanA full solution test run is not available on the Linux validation host because
UninstallToolsuses COM references requiring the Windows/.NET Framework MSBuild path.