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

Implement "attach" property support for Blazor debug extension #21716

Closed
captainsafia opened this issue May 11, 2020 · 4 comments
Closed

Implement "attach" property support for Blazor debug extension #21716

captainsafia opened this issue May 11, 2020 · 4 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly

Comments

@captainsafia
Copy link
Member

This issue depends on the changes introduced in dotnet/razor#1885.

Currently, the Blazor debugger supports the launch property, meaning it starts a new dev server and browser from scratch.

Launch configurations can also support an attach option. For example, the VS Code Chrome debug extension will attach to an existing browser (enabled with debugging) that is set to the same URL the user is targetting.

@captainsafia captainsafia added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly area-razor.tooling labels May 11, 2020
@mkArtakMSFT mkArtakMSFT added this to the 5.0.0-preview4 milestone May 11, 2020
@captainsafia captainsafia changed the title Investigate "attach" property support for Blazor debug extension Implement "attach" property support for Blazor debug extension May 12, 2020
@captainsafia
Copy link
Member Author

captainsafia commented May 12, 2020

The implementation for this will assume that a user has:

  • Already configured the inspectUri in their launch settings correctly
  • Is running the application server on their machine
  • The user has already launched Chrome/Edge with the remote-debugging flags enabled

The requirements above are a mix of what our dev server needs and what the underlying JS debugger expects.

The attach configuration for the Blazor debugger will look something like this. The attach configuration will accept the same configuration attributes as the launch configuration.

{
  type: "blazorwasm",
  request: "attach",
  browser: "edge"
}

Under the hood, this configuration will not spawn a process for the devserver and will launch the browser in attach mode. Unlike launch mode, attach mode will not clean up the devserver processes on the system. I think it is sensible to expect if it is not launched from the debugger, it doesn't need to be cleaned up by the debugger.

@captainsafia
Copy link
Member Author

A conversation with @SteveSandersonMS has me re-thinking this a bit.

The interpretation of "attach" that I used above relies on a literal mapping of how attach currently works in the JS debug adapter.

In actuality, a user using the "blazorwasm" debug adapter to "attach" probably intends to attach to a running Blazor WASM application, not a running debugging browser.

This makes a lot more sense and is probably more useful to users than the model proposed above.
For example, maybe you want to run your Blazor WASM application in watch mode and want the attach request in the "blazorwasm" debug adapter to open a new debugging session attached to this running process.

Besides, if a user has already done the work to launch a browser in debug mode hooked to their application then the adapter isn't really providing much of an additional value to them (aside for hooking up their session to VS Code which 🤷)

So really, the experience should be, you run dotnet run somewhere else to launch your application then attach via the blazorwasm debug adapter to launch your debugging browser.

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented May 22, 2020

@captainsafia That sounds good to me. I agree that the most useful "attach" gesture would be "open a new browser and attach it to an existing running app", rather than "attach the IDE to an existing browser+app pair".

Could it be configurable? For example, if the launch settings options included a launchBrowser bool flag (defaulting to true), then that could control whether you're doing "launch a new browser and attach to existing app" versus "attach the IDE to an existing browser+app".

If making it configurable makes it really complicated then I'd be fine with only having the option to open a new browser (attaching to an existing app).

@captainsafia captainsafia added Done This issue has been fixed and removed Working labels May 27, 2020
@captainsafia
Copy link
Member Author

We've got the flexibility to support both, it's largely a matter of how simple we want to keep the configuration to the end user.

The debugging adapter we're releasing this week supports the launchBrowser=true scenario. We can see how users react to this and make updates accordingly.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2020
@ghost ghost unlocked this conversation Oct 9, 2021
@dotnet dotnet locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly
Projects
None yet
Development

No branches or pull requests

4 participants