Skip to content

Debugging Blazor WASM in VSCode Holds Debug Session and Ports Open #38382

Closed
@caffeinerobot

Description

@caffeinerobot

Describe the bug

Starting a debug session for Blazor WASM from within VSCode works fine the first time. Closing the debug session and trying to start another one causes the below error to pop up.

"It looks like a browser is already running from an old debug session. Please close it before trying to debug, otherwise VS Code may not be able to connect to it.
(Cancel / Debug Anyway)"

Trying to start from command line using "dotnet run" after this fails as the port is still in use. The only way to resolve the issue is to reboot or go hunting for the orphaned process and force kill it.

I have always had this problem with Blazor WASM apps for dotnet-sdk-5.0 and now have the same problem with a brand new app created using dotnet-sdk-6.0.

To Reproduce

  • Install VSCode, dotnet-sdk-6.0 and Chromium on Linux Debian 10.
  • Create a new blazorwasm app: "dotnet new blazorwasm --auth Individual -o dotnet6blazorwasm -ho"
  • Open in VSCode
  • Debug the Server project
  • Stop debugging
  • Start debugging again

Further technical details

  • ASP.NET Core version: 6.0
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version: VSCode 1.62.2
  • Include the output of dotnet --info:
dotnet --info Output

.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff

Runtime Environment:
OS Name: debian
OS Version: 10
OS Platform: Linux
RID: debian.10-x64
Base Path: /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa

.NET SDKs installed:
3.1.415 [/usr/share/dotnet/sdk]
5.0.403 [/usr/share/dotnet/sdk]
6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

Activity

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

Metadata

Metadata

Assignees

Labels

DocsThis issue tracks updating documentationPriority:1Work that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-debuggingThis issue is related to debugging of Blazor WebAssembly appsfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyfeature-razor.vscode

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions