Skip to content
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

Using 'launchBrowser' can break debugging with 'Unexpected end of JSON input' error #1274

Closed
osmarlandin opened this issue Mar 1, 2017 · 4 comments
Assignees
Milestone

Comments

@osmarlandin
Copy link

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-1-003177)

Product Information:
Version: 1.0.0-preview2-1-003177
Commit SHA-1 hash: a2df9c2576

Runtime Environment:
OS Name: fedora
OS Version: 24
OS Platform: Linux
RID: fedora.24-x64

VS Code version:
1.9.1

C# Extension version:
1.7.0

Steps to reproduce

  1. Create a new web project using dotnet new -t web
  2. Restore packages using dotnet restore
  3. Using Code, press F5 to start debug

Expected behavior

Debugger should work as expected

Actual behavior

Debug stops working and Code shows the error message "Unexpected end of JSON input. Stopping the debug adapter."

VS Code creates the file launch.json under .vscode folder. Inside that file, the configuration below is automatically created:
{ "name": ".NET Core Launch (web)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", "program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>", "args": [], "cwd": "${workspaceRoot}", "stopAtEntry": false, "launchBrowser": { "enabled": true, "args": "${auto-detect-url}", "windows": { "command": "cmd.exe", "args": "/C start ${auto-detect-url}" }, "osx": { "command": "open" }, "linux": { "command": "xdg-open" } }, "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, "sourceFileMap": { "/Views": "${workspaceRoot}/Views" } }
As I observed, the problem is when using the launchBrowser configuration. Commenting that line, debugger works as expected. If use this configuration, debugger crashes.

@gregg-miskelly gregg-miskelly changed the title Debug stops working on Fedora 24 Using 'launchBrowser' can break debugging with 'Unexpected end of JSON input' error Mar 2, 2017
@gregg-miskelly gregg-miskelly added this to the 1.8 milestone Mar 2, 2017
@gregg-miskelly
Copy link
Contributor

I think I see the problem. If so this looks pretty simple to fix -- we are currently NOT redirecting standard output when launching the browser (just standard error). I believe this will mean that any standard output text will get passed to VS Code which will try and interpret it as JSON. So all we need to do is monitor stdout and drop the text on the floor.

@gregg-miskelly gregg-miskelly self-assigned this Mar 3, 2017
gregg-miskelly added a commit to gregg-miskelly/vscode-csharp that referenced this issue Mar 4, 2017
This updates the debugger packages to the latest build. This includes the external console work, and which I hope is the fix for:

dotnet#1274
gregg-miskelly added a commit to gregg-miskelly/vscode-csharp that referenced this issue Mar 4, 2017
This updates the debugger packages to the latest build. This includes the external console work, and which I hope is the fix for:

dotnet#1274
gregg-miskelly added a commit that referenced this issue Mar 4, 2017
* Update the debugger packages to the 03-03-2017 build

This updates the debugger packages to the latest build. This includes the external console work, and which I hope is the fix for:

#1274

* Fix lint warning

* Remove BOM from package.json

Somehow I must have accidentially added a BOM to package.json. This removes it.
@gregg-miskelly
Copy link
Contributor

@osmarlandin I added a beta release (1.8-beta2) that I hope addresses your issue. Can you give it a try when you have the chance and see if your issue is fixed? Instructions: https://github.com/OmniSharp/omnisharp-vscode/wiki/Installing-Beta-Releases

@osmarlandin
Copy link
Author

@gregg-miskelly Everything ok. Thank you!

@gregg-miskelly
Copy link
Contributor

@osmarlandin great! Thanks for checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants