Skip to content
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

Wait for file change when process exits #47427

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

tmat
Copy link
Member

@tmat tmat commented Mar 10, 2025

Fixes #47425.

There are two code paths that may be executed when process exists ,depending on exact timing of task cancellation.
One of the code paths was incorrectly not waiting for a file update before restarting the app.

@Copilot Copilot bot review requested due to automatic review settings March 10, 2025 21:29
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Request triage from a team member labels Mar 10, 2025
@tmat
Copy link
Member Author

tmat commented Mar 10, 2025

@phil-allen-msft ptal

@tmat tmat added this to the 9.0.3xx milestone Mar 10, 2025

Choose a reason for hiding this comment

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

PR Overview

This PR fixes an issue where the file change is not awaited when a process exits. It includes changes to update the file change callback logic in HotReloadDotNetWatcher.cs and updates the ProcessCleanupTimeout configuration in EnvironmentVariables.cs.

  • Updated file change callback behavior to wait for a file update on process exit.
  • Modified ProcessCleanupTimeout configuration to use a default value of 5 seconds.
  • Adjusted the ReadTimeSpan method to accept a default value for improved configurability.

Reviewed Changes

File Description
src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs Updated the catch block to always wait for file change when the process exits.
src/BuiltInTools/dotnet-watch/EnvironmentVariables.cs Modified ProcessCleanupTimeout to include a configurable default value and updated ReadTimeSpan accordingly.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs:223

  • The removed assignment to false followed by setting the value to true in the catch block may cause confusion. Consider removing the commented-out assignment to clarify that the intended behavior is to wait for a file change when the process exits.
waitForFileChangeBeforeRestarting = false;

src/BuiltInTools/dotnet-watch/EnvironmentVariables.cs:51

  • The original ReadTimeSpan method signature has been removed in favor of one that requires a default value. Please verify that all calls to ReadTimeSpan have been updated accordingly to prevent any unintended behavior.
private static TimeSpan ReadTimeSpan(string variableName)
@tmat tmat enabled auto-merge (squash) March 11, 2025 00:56
@tmat tmat merged commit ae300dd into dotnet:release/9.0.3xx Mar 11, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants