aspnetcore
aspnetcore copied to clipboard
Set `launchBrowser` to `false` by default, in launchSettings.json
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
The launchBrowser setting is perhaps useful when first launching a project, but quickly becomes hugely annoying when a new browser tab is opened each time that you run the application, including during debugging.
Describe the solution you'd like
I suggest that this setting is set to false by default to prevent this behaviour. A link is usually available in the terminal for quick access when first launching the application.
In an ideal world, the already-opened tab would be reused, but as far as I know, this is not possible.
Additional context
No response
A link is usually available in the terminal for quick access when first launching the application
Let's assume some HTTP API project where the OpenAPI document / swagger should be opened, then that link isn't enough.
For me it's quite easy to update the value in the launchSettings file, so I don't know what is the better default here (true / false). Is it clear for less experienced user what to do to update the setting?
In an ideal world, the already-opened tab would be reused
That's the behavior I see (when running from VS). How do you run the app?
Let's assume some HTTP API project where the OpenAPI document / swagger should be opened, then that link isn't enough.
But wouldn't that require the user to set a launchUrl in launchSettings.json anyway? Or does VS insert that? (I'm not using VS)
For me it's quite easy to update the value in the launchSettings file, so I don't know what is the better default here (true / false). Is it clear for less experienced user what to do to update the setting?
I guess the same is true for the reverse? If it's easy enough to disable, then it's easy enough to enable. The question is then what is the most logical default. I run applications hundreds of times, but I only need the browser to be opened once.
That's the behavior I see (when running from VS). How do you run the app?
Running from the CLI doesn't seem to do anything (?), so I assume that this is controlled by the IDE? Both Rider and VS Code open a new tab each time that the application is launched.
Oh, coming here from @gfoidl's comments on the PR referenced above.
We got some feedback that now that Swagger UI is removed from the Web API template, launching the browser to show a JSON payload can be confusing, especially when the weather forecast endpoint is authenticated.
The launchUrl is currently only respected by Visual Studio/VS Code so those are the primary targets impacted by this change.
IMO, not launching the browser for a non-UI application makes sense. There was some consideration about whether this means users are losing a visual indication in their editor that the app is running. This would primarily impact Ctrl + F5 scenarios where the visual indication of the app running might be subtle.
@sayedihashimi
I'll respond here, to avoid adding noise to the PR.
I disagree. Having this enabled by default is important for new users as well as learners. Removing that will cause friction for those users.
But the feature is broken. It doesn't just open the URL once, it opens the URL every time that you run or debug the application. This is a nuisance for both experienced and new users.
If this works correctly for Visual Studio (I don't have it installed), then perhaps the VS developers could share their implementation with the VS Code team? Rider would still be affected though.
Until it works correctly across most IDEs, having it enabled by default doesn't seem correct.
For the experienced developers, they can configure the setting to false if they prefer that.
Every developer, regardless of their experience level, will need to disable this option when not using Visual Studio, to avoid having endless new tabs opened in their browser.
@glen-84 it sounds like you're specifically giving feedback on the VS Code/C# Dev Kit experience. If that's the case, the correct repo for C# Dev Kit feedback is https://github.com/microsoft/vscode-dotnettools.
The behavior in Visual Studio and VS Code does differ slightly. The experience is more "managed" in Visual Studio versus VS Code.
Every developer, regardless of their experience level, will need to disable this option when not using Visual Studio, to avoid having endless new tabs opened in their browser.
In the 14 years that I've been working in this space, this is one of the first times that I've heard complaints about this. And we've been launching the browser in the same way for that entire time. Based on that, I disagree with your statement. My experience is mostly from Visual Studio though, so I can't say for sure regarding the VS Code workflows.
it sounds like you're specifically giving feedback on the VS Code/C# Dev Kit experience. If that's the case, the correct repo for C# Dev Kit feedback is https://github.com/microsoft/vscode-dotnettools.
No, I'm giving feedback on the ecosystem in general, which also includes Rider.
The behavior in Visual Studio and VS Code does differ slightly. The experience is more "managed" in Visual Studio versus VS Code.
I'm curious as to how Visual Studio actually implements this. As far as I know, it's not something that browsers support directly. The only thing that I could think of would be attempting to connect to an existing page via a web socket, before opening a duplicate tab.
In the 14 years that I've been working in this space, this is one of the first times that I've heard complaints about this. And we've been launching the browser in the same way for that entire time. Based on that, I disagree with your statement. My experience is mostly from Visual Studio though, so I can't say for sure regarding the VS Code workflows.
This is surprising. I surely can't be the only one using a non-VS IDE that is being affected by this.
Rider doesn't have to follow that value in launchSettings.json they are free to come up with a different design for their support. The properties in launchSettings.json are designed so that tools can decide to support different properties. There are other properties in that file which Rider doesn't support, for example the IIS Express/IIS settings.
In VS when you F5 (start debugging) we launch the browser and when you close the browser, the debugger stops as well. If you stop debugging the browser tab is closed as well. If you CTRL-F5 (start without debugging) we start the process, launch the browser and then it's up to you to stop the process/close the browser. I'm not sure what options are available in Rider, but if they have something similar to CTRL-F5, that may work better for you. There are some additional options in VS which supplement the property in launchSettings.json.
for example the IIS Express/IIS settings
Which were removed, specifically because they were only applicable to VS.
if they have something similar to CTRL-F5, that may work better for you
How?
- If I need to debug then I need to debug, I can't "fix" this by avoiding debugging.
- This still opens a new tab each time, even with VS.
Anyway, I'll close this issue now, even though my highly scientific poll (LOL) shows that I'm not the only one affected by this.
@glen-84 it was removed from the templates because most prefer to use kestrel. The option still appears in Visual Studio and when a user selects to use IIS Express the config is then added to launchSettings.json. There is no reason to have that in the file if most users don't use it.
It sounds like you are providing feedback for a Rider experience and stating that they must honor the launch setting in the launchSettings.json but that's not true, they can add an option that extends, or overrides, that experience.
It sounds like you are providing feedback for a Rider experience and stating that they must honor the launch setting in the
launchSettings.jsonbut that's not true, they can add an option that extends, or overrides, that experience.
I don't know how you came to this conclusion.
- Firstly, as I've already stated, my feedback is for all non-VS IDEs, including VS Code, which is a Microsoft product.
- Secondly, Rider does honour the launch setting, it just doesn't reuse the browser tab. The same is true for VS Code, leading to a poor DX.
I'll just remove this setting in every project that I create.