question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatically generated launch.json will not launch web browser

See original GitHub issue

Azure DevOps work item: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1265977

Testcases Affected All scenarios via debug with VSCode.

Repro Steps

  1. Create a folder and create a new console app. :
mkdir Angular
cd Angular
dotnet new angular 
  1. Open the folder with VSCode.
code .
  1. Install C# extension.
  2. 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’.
  3. Press F5 and select ‘.NET Core’.
  4. Update the argument of ‘Program’. image Update: image
  5. 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: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
submodifycommented, Feb 12, 2021

@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-browser

0reactions
submodifycommented, Feb 12, 2021

Was 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found