-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Describe the bug:
Following the guides Debug ASP.NET Core Blazor WebAssembly and Tooling for ASP.NET Core Blazor it is not possible to launch the basic Blazor webassembly template for debugging in Visual Studio Code on Linux.
Version used:
- Ubuntu 20.04
- Chromium Browser Version 97.0.4692.99 (Official Build) snap (64-bit)
- google-chrome browser (Version 97.0.4692.99 (Official Build) (64-bit))
(I've installed it additionally, because I think that the c# extension doesn't
work with chromium. But this is another topic) - .NET 6.0.101 (sdk)
- Visual studio Code Version: 1.63.2
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.13.0-27-generic snap
With the following extensions:- C# for Visual Studio Code v1.24.0
- Microsoft.AspNetCore.Razor.VSCode.BlazorWasmDebuggingExtension Released on 2/2/2021, 01:34:39, Last updated5/21/2021, 19:16:17
To reproduce:
Steps to reproduce the behavior:
- Create a new project
dotnet new blazorwasm -o BlazorWasmDemo1
- Open project in VSCode. You'll be asked Required assets to build and debug are missing from 'BlazorWasmDemo1'. Add them?
Click on Yes - Start a debugging session by hitting F5.
Expected behavior:
Browser should be opened and load the application for debugging, breakpoints should work.
Actual behavior:
When starting for debugging (F5)
Chrome-browser opens up in some kind of integrated window of VSCode but with an empty address field.
After a few seconds I get the error-message Unable to launch browser.
Even if I enter the address https://localhost:7046 manually, the error message appears after a few seconds.

Stopping the debug session and starting it again after a few minutes I get the message, that it looks, that a browser is already running from an old debug session.

Debugging is not possible at all. If i set a breakpoint, for example on the line where the count-page increases the count-variable, it shows me "unbound breakpoint".
If I'm fast enough and enter the address https://localhost:7046 manually, wait for the page to be loaded and press SHIFT + ALT + D to start the debugging view from chrome, I see this page
Unable to find debuggable browser tab
Could not get a list of browser tabs from http://localhost:9222/json. Ensure your browser is running with debugging enabled.
Resolution
If you are using Google Chrome for your development, follow these instructions:
In a terminal window execute the following:
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/blazor-chrome-debug https://localhost:7046/
If you are using Microsoft Edge (80+) for your development, follow these instructions:
Edge is not current supported on your platform
This should launch a new browser window with debugging enabled..
Underlying exception:
System.Net.Http.HttpRequestException: Connection refused (localhost:9222)
---> System.Net.Sockets.SocketException (111): Connection refused
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Components.WebAssembly.Server.TargetPickerUi.GetOpenedBrowserTabs()
at Microsoft.AspNetCore.Components.WebAssembly.Server.TargetPickerUi.Display(HttpContext context)
Additional context:
And I got this files added:
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/BlazorWasmDemo1.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/BlazorWasmDemo1.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/BlazorWasmDemo1.csproj"
],
"problemMatcher": "$msCompile"
}
]
}and
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch and Debug Standalone Blazor WebAssembly App",
"type": "blazorwasm",
"request": "launch",
"cwd": "${workspaceFolder}"
}
]
}and for completeness, the
launchsettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:43638",
"sslPort": 44332
}
},
"profiles": {
"BlazorWasmDemo1": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7046;http://localhost:5256",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}The full project be found here.