Automatically generated launch.json will not launch web browser
See original GitHub issueAzure DevOps work item: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1265977
Testcases Affected All scenarios via debug with VSCode.
Repro Steps
- Create a folder and create a new console app. :
mkdir Angular
cd Angular
dotnet new angular
- Open the folder with VSCode.
code .
- Install C# extension.
- Add required assets manually. a. Open the Visual Studio Code command palette (View->Command Palette)Open the Visual Studio Code command palette (View->Command Palette) b. run the command: ‘.NET: Generate Assets for Build and Debug’.
- Press F5 and select ‘.NET Core’.
- Update the argument of ‘Program’. Update:
- Press F5 to start debugging.
ACTUAL Couldn’t load the website automatically.
EXPECTED The program running correctly and load web site automatically.
INVESTIGATION The web site display correctly when I tried to open it manually with listening URL in debug console window:
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
vscode launch.json debug and open specific url - Stack Overflow
I'd like this to launch the browser to localhost:5000/swagger when I debug, but I've tried half a dozen different things and nothing works....
Read more >Configure launch.json for C/C++ debugging in Visual Studio ...
Visual Studio Code generates a launch.json (under a .vscode folder in your project) with almost all of the required information. To get started...
Read more >A launch.json setting for end-to-end web development
When I start a new project these days I create the following launch.json file and put in in a ... It will not...
Read more >How to launch different browsers from VS Code for debugging ...
json file. You can find the launch.json file under .vscode folder. Then you need to click on the Add Configuration button.
Read more >Don't Launch a Browser Running ASP.NET Core Back-end ...
NET Core Back-end Created from Web Template Studio ... The options that are available for running in VSCode are controlled by a launch.json...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@NTaylorMullen: Had this issue today working through an Microsoft ASP.NET tutorial. Browser fails to launch automatically when debugging. Found the issue to be “serverReadyAction” in auto generated launch.json. It had the pattern as:
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
too many backslashes?.. It work after changing it to:"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
for reference: https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#starting-a-web-browserWas following this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-5.0&tabs=visual-studio-code
Basically this (from the VS Code terminal):
dotnet new webapp -o RazorPagesMovie
code -r RazorPagesMovie
then hitting CTRL-F5 to run. This doesn’t launch the browser automatically as expected.
Looking at the generated launch.json , the “serverReadyAction” pattern is showing:
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
changing it to this works as expected:
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
Windows 10 VS Code: 1.53.2 .NET 5.0.103 C# Extension 1.23.9