Skip to content

Refresh PATH in configuration remoting server #5511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yao-msft
Copy link
Contributor

@yao-msft yao-msft commented Jun 9, 2025

Added a hidden window to listen for UserPreferenceChanged event (WM_SETTINGCHANGE) and update the process's PATH if needed.

Manually validated by running a configuration file with multiple resources, change the env var during the run, and verified in logs file that new path got included in runs after the change.

Microsoft Reviewers: Open in CodeFlow

@yao-msft
Copy link
Contributor Author

yao-msft commented Jun 9, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm that the server process exits cleanly when the client completes.

/// </summary>
public static void UpdatePath()
{
List<string> paths = new List<string>(Environment.GetEnvironmentVariable(PathEnvironmentVariable)?.Split(';') ?? Array.Empty<string>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a HashSet<string> to make the looped Contains calls in AddPathsIfNotExist more efficient?

{
if (!currentPaths.Contains(path))
{
currentPaths.Add(path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always adds to the end, making it the last location to look. That may cause issues in some corner case; probably ok for now but maybe add a comment.

The "proper" thing to do would probably be to calculate the full new list of paths (what one would expect to get from a new process launch) and use a line merge algorithm with a strategy that puts the ephemeral entries before the new permanent ones. But that is a fair bit more complicated and could wait until later.

@yao-msft
Copy link
Contributor Author

Please confirm that the server process exits cleanly when the client completes.

I can confirm ConfigurationRemotingServer.exe exits right after configuration completes.

@yao-msft
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants