Fix portable path removal on upgrade #5756
Merged
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.
Closes #4044
Closes #3616
The path is being lost under the condition of Dev Mode being disabled with a user install, because we only set the PATH if symlinks are not available. In this situation, the portable package is registered with a path set, and that information is added to the ARP entry. When an upgrade occurs, this path being set value is true and when removing the old version we are also removing the path since it was set. Then when we add the new version, the variable that says the path was set is still true, so it does not re-add the path and does not set the path information in the ARP entry.
The fix is to update the variable that indicates the path has been set whenever we remove the path. This causes the install of the new version to recognize that the path has been removed and to re-enable it (and then re-set the variable). This is a targeted fix that only affects the PATH setting
Repro steps for this issue:
With the fix step 5 is the same result as step 3.
Tested:
Microsoft Reviewers: Open in CodeFlow