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

Attaching webassembly debugger causes a second copy of the app to start #27518

Closed
SteveSandersonMS opened this issue Nov 4, 2020 · 2 comments · Fixed by dotnet/razor#2774
Closed
Assignees
Labels
affected-most This issue impacts most of the customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly severity-minor This label is used by an internal tool
Milestone

Comments

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Nov 4, 2020

Scenario:

Repro steps:

  • cd Client
  • dotnet run
  • Note from terminal output that only one copy of the client app is running, and it's listening on ports 5000 and 5001. For example, you see the following (and nothing else!):
> dotnet run
Building...
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\git\captainsafia\blazoract\Client
  • Now in VS Code, start the debugger with a launch profile like this:
    {
        "name": "Attach to Blazor WebAssembly App",
        "type": "blazorwasm",
        "request": "attach",
        "cwd": "${workspaceFolder}/Client",
        "url": "https://localhost:5001",
        "browser": "edge"
    },
  • Expected: debugger attaches to the existing running app, and no further copy of the app is started. After finishing debugging, you should be able to click the "disconnect" button, then immediately start debugging again with the same settings successfully.
  • Actual: It does launch a browser that connects to the existing running app on port 5001, but:
    • In the terminal output you can see that a second copy of the app was started, because it now logs the following:
Hosting environment: Production
Content root path: C:\git\captainsafia\blazoract\Client
Now listening on: http://127.0.0.1:64363
Application started. Press Ctrl+C to shut down.

Also, when you're done with debugging, if you stop it with Shift+F5 and then right after try to restart debugging with F5 again, you'll get this:

image

... and in the terminal you'll see:

got exception System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server
 ---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (127.0.0.1:64356)
 ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   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)

... and from this state, the only way to get the debugger to work again is to force-quit the app in your terminal via ctrl+c, which exits both the unwanted extra copy of the app and the original copy that you didn't want to close.

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Nov 4, 2020
@captainsafia
Copy link
Member

captainsafia commented Nov 4, 2020

In the terminal output you can see that a second copy of the app was started, because it now logs the following:

This bit is expected. The output is the piped output from the debugging proxy.

Also, when you're done with debugging, if you stop it with Shift+F5 and then right after try to restart debugging with F5 again, you'll get this:

This bit is not expected. It looks like the debugging proxy might've been killed during Shift + F5 and failed to launch when debugging was initialized a second time.

EDIT: I've been doing some work on the VS Code blazorwasm debugger and will look at this issue with that.

@captainsafia captainsafia added bug This issue describes a behavior which is not expected - a bug. feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps labels Nov 4, 2020
@captainsafia captainsafia self-assigned this Nov 4, 2020
@captainsafia captainsafia added this to the Next sprint planning milestone Nov 4, 2020
@ghost
Copy link

ghost commented Nov 4, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@captainsafia captainsafia added affected-most This issue impacts most of the customers severity-minor This label is used by an internal tool labels Nov 6, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-most This issue impacts most of the customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly severity-minor This label is used by an internal tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants