Repository navigation
fix: Environment Variables' Apply never writes over a change it did not see, and a new variable is User or System - #2951
Merged
Conversation
…ot see, and a new variable is User or System - Apply compared each variable with the value the tab read when it opened and wrote the edited copy without reading the registry again, so a folder an installer added to PATH meanwhile was gone after the next PATH edit. After the confirmation, Apply now reads every variable it is about to write or delete again, through EnvironmentVariableService.TryReadValue, and applies nothing when one changed, a new one appeared under the same name, or one could not be read again. The status line names them and says to Refresh. - The "New variable scope" picker listed the scope filter's choices, so "All" made one User variable and the status line said "Added All variable". It has its own list, User and System.
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.
Apply on Environment Variables wrote the copy of a variable the tab had read when it opened, so a change made outside
the tab meanwhile was written over, and the new-variable picker offered "All".
What changed
to PATH, and the tab stays open for as long as SysManager runs. Moving one PATH row and pressing Apply wrote back the
PATH the tab had read, and the installer's folder was gone. After the confirmation, Apply now reads every variable
it is about to write or delete again through the new
EnvironmentVariableService.TryReadValue, raw asReadreadsit, and applies nothing, the safety copy included, when one changed, a new one appeared under the same name, or one
could not be read again. The status line names them, "PATH (User) was changed outside SysManager after this tab read
it, so nothing was applied. Press Refresh to see the change, then make yours again.", and the edit stays pending.
ScopeFilters, whose "All" made oneUser variable while the status line said "Added All variable 'X'". It binds
NewScopes, User and System.EnvVariable.LabelOfnames a scope the wayScopeLabeldoes, for the variables Apply has only a scope and a namefor.
EnvironmentVariablesViewModel).Tests
Over the redirected environment the other tests use, so no real variable is read or written:
as the installer left it, writes no safety copy, says why and keeps the edit pending. With nothing changed outside,
the same Apply writes.
TryReadValuereads a value raw and returns null fornone;
NewScopesis User and System and the view's picker binds it.Each test failed against the defect it pins: with no check, with new variables or deletions left out of it, with the
value read expanded, and with the picker bound to the filter's list.
Closes #2798.