Let an explicit MaxInstancesToLaunch beat DiffEngine_MaxInstances - #852
Merged
Conversation
DiffEngine_MaxInstances was read ahead of the app domain value, and it persists per user - the tray writes it to the user environment on every settings save. So on a machine that had ever saved tray settings, DiffRunner.MaxInstancesToLaunch silently did nothing, and a test calling it to keep diff windows shut still had them open. Read the app domain value first, as DiffRunner.Disabled already does for an explicit set, leaving the environment as the ambient default for a run that sets nothing. Two things behind that, in SetForUser: - A save that changes nothing writes nothing. Write is handed whatever the options form was populated with, which is the value already in effect, and unrelated saves come through the same path - the "always kill locking processes" prompt persists itself that way and has no options form at all. Opening the tray once was enough to leave a user scope variable behind on a machine that had never chosen a limit. - Choosing the default clears the variable rather than persisting it, as SetTargetOnLeft does with false, so there is a way back to an unset machine through the options form. Tests wrote the user environment of the machine running them, and could not put it back reliably: the test projects run as parallel processes over the one registry key, so a capture in one and a restore in the other race. EnvironmentHelper.Set is now swappable, and both test module initializers keep those writes inside the process.
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.
DiffEngine_MaxInstances was read ahead of the app domain value, and it persists per user - the tray writes it to the user environment on every settings save. So on a machine that had ever saved tray settings, DiffRunner.MaxInstancesToLaunch silently did nothing, and a test calling it to keep diff windows shut still had them open.
Read the app domain value first, as DiffRunner.Disabled already does for an explicit set, leaving the environment as the ambient default for a run that sets nothing.
Two things behind that, in SetForUser:
Tests wrote the user environment of the machine running them, and could not put it back reliably: the test projects run as parallel processes over the one registry key, so a capture in one and a restore in the other race. EnvironmentHelper.Set is now swappable, and both test module initializers keep those writes inside the process.