Dotnet watch browser refresh configurable port#50629
Conversation
|
This PR is targeting |
|
Thanks for your PR, @@wes-sleeman. |
|
@dotnet-policy-service agree |
|
@dotnet/domestic-cat |
|
@wes-sleeman All Watch stuff goes to @tmat, so we'll wait for him to chime in. Thanks for making your contribution! We're technically still open for SDK-level changes for a couple more weeks, so it's possible this could make it to .NET 10. That would require a backport (which we can trigger) once this merges - since It's very unlikely that we would backport this to 8.x or 9.x SDKs without a really compelling customer use case, or some kind of external partner to justify the work + ongoing maintenance. The SDK is mostly a fix-forward kind of component for features - majorly-impactful bug fixes and security updates are the main category of thing that would be backported. |
|
@baronfel, thanks for the quick reply! Would enjoy this making it into .NET 10 as this has been a blocker for me leveraging .NET with my team at work (enough to make me file this PR in my spare time!), so happy to hear there's a chance on that. |
|
@wes-sleeman Would you mind updating your PR to resovle the conflicts? You'll need to add a new property to EnvironmentOptions flow it as a parameter to BrowserRefreshServer constructor. |
|
@tmat Sorry for the delay! Only just got around to resolving this. Looks like you re-architected this whole feature a few days ago. I've merged the changes in sensibly and added the necessary helper function to make it an |
|
@wes-sleeman Thanks for your effort! |
|
/backport to release/10.0.1xx |
1 similar comment
|
/backport to release/10.0.1xx |
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17746309610 |
|
@tmat backporting to "release/10.0.1xx" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Added port selection logic to the browser refresh script
Using index info to reconstruct a base tree...
A src/BuiltInTools/dotnet-watch/Browser/BrowserRefreshServer.cs
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): src/BuiltInTools/dotnet-watch/Browser/BrowserRefreshServer.cs deleted in HEAD and modified in Added port selection logic to the browser refresh script. Version Added port selection logic to the browser refresh script of src/BuiltInTools/dotnet-watch/Browser/BrowserRefreshServer.cs left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Added port selection logic to the browser refresh script
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
Add an environment variable to permit deterministic and user-controlled selection of the browser refresh port when using the hot reload feature of
dotnet watch.This PR adds a new environment variable named
DOTNET_WATCH_AUTO_RELOAD_WS_PORTto provide the other half of the functionality provided byDOTNET_WATCH_AUTO_RELOAD_WS_HOSTNAME. This is particularly useful in situations such as container-based development workflows as it allows for specific port forwarding rules to be hard-coded in advance.First-time contribution, so any tips on how I can get this backported as far as we usually support would be appreciated.
Closes dotnet/aspnetcore#33823