-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet watch doesn't launch browser correctly if the listening URL has a trailing slash #36709
Labels
Milestone
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
eerhardt
added a commit
to dotnet/aspire
that referenced
this issue
Nov 7, 2023
eerhardt
added a commit
to dotnet/aspire
that referenced
this issue
Nov 7, 2023
* Allow dotnet watch to work with Aspire Dashboard dotnet watch needs the URL message to be of a specific format. Fixing our message to conform. Fix #711 * Trim trailing slash to allow dotnet watch to work. Workaround dotnet/sdk#36709
eerhardt
added a commit
to dotnet/aspire
that referenced
this issue
Nov 7, 2023
* Allow dotnet watch to work with Aspire Dashboard dotnet watch needs the URL message to be of a specific format. Fixing our message to conform. Fix #711 * Trim trailing slash to allow dotnet watch to work. Workaround dotnet/sdk#36709
danmoseley
pushed a commit
to dotnet/aspire
that referenced
this issue
Nov 7, 2023
* Allow dotnet watch to work with Aspire Dashboard dotnet watch needs the URL message to be of a specific format. Fixing our message to conform. Fix #711 * Trim trailing slash to allow dotnet watch to work. Workaround dotnet/sdk#36709
Here's a simple repro:
var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
var app = builder.Build();
app.Lifetime.ApplicationStarted.Register(() => Console.WriteLine("Now listening on: http://localhost:7126/"));
app.MapGet("/", () => "Hello World!");
app.Run(); (you can change the port number to whatever number you have in your launchSettings.json).
You'll see And when the browser launches, it will have 2 trailing slashes, like in the picture in the original post. |
Fixed by #46100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using
dotnet watch
, it parses the console output forNow listening on: <URL>
. See:sdk/src/BuiltInTools/dotnet-watch/Filters/LaunchBrowserFilter.cs
Line 13 in 91271e3
sdk/src/BuiltInTools/dotnet-watch/Filters/LaunchBrowserFilter.cs
Lines 72 to 88 in 91271e3
When this URL has a trailing slash like
Now listening on: http://localhost:15888/
, the browser launches, but the page is broken:The code is always appending a
/
, which is causing the issue:sdk/src/BuiltInTools/dotnet-watch/Filters/LaunchBrowserFilter.cs
Lines 114 to 118 in 91271e3
To Reproduce
Have a web app that writes
Now listening on: http://localhost:15888/
to the console.dotnet watch
it and notice the browser launches, but doesn't hit the endpoint correctly.The text was updated successfully, but these errors were encountered: