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

Change how wasm debug host is determined to match VS behavior #18318

Open
SteveSandersonMS opened this issue Jan 13, 2020 · 0 comments
Open

Change how wasm debug host is determined to match VS behavior #18318

SteveSandersonMS opened this issue Jan 13, 2020 · 0 comments

Comments

@SteveSandersonMS
Copy link
Member

@SteveSandersonMS SteveSandersonMS commented Jan 13, 2020

Currently, we have this code which determines the address of the debugger host. We use this value to ask the browser to give us a list of debuggable browser tabs. The default value is http://localhost:9222 but it can be overridden using an env var called ASPNETCORE_WEBASSEMBLYDEBUGHOST. Previously our intention was that VS would use ASPNETCORE_WEBASSEMBLYDEBUGHOST to tell us about the port number it's using when it launches Edge/Chrome on a different port other than 9222.

However, following discussions with @digeff, we've now found it will be necessary not to use an environment variable, because VS won't know the port number until after it's started up the Blazor application server. VS needs to start up the Blazor application server first, and then start up the browser, and by this time whatever port it was thinking of using might no longer be available.

The intended solution is that we have an alternative way for VS to communicate the debug host info into the Blazor debug proxy middleware. A simple solution is that VS can make an HTTP(S) request to {application_url}/framework/debughost?host={url}, where {url} might be something like http://localhost:12345. This request will be made before VS makes a request to {application_url}/json, so we should have the necessary info at the right time.

Work required by us

Remove the logic that reads ASPNETCORE_WEBASSEMBLYDEBUGHOST. Replace it with a new bit of logic in the debug middleware that accepts a request to PUT framework/debughost?host={url}, and stores the {url} so it can use it in place of ASPNETCORE_WEBASSEMBLYDEBUGHOST.

Also, our reply to this request should be some JSON that specifies the CDP websocket endpoint that VS should connect to. That is, we should use the same logic that we do when handling /json to determine this information. The exact shape of the response can be whatever we want, as the VS JS debugger team will make sense of it. For example, we could reply with something like:

{ "webSocketDebuggerUrl": "wss://...blah..." }

... where wss://...blah... is determined using the same logic as this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Blazor WASM
  
3.2 - Preview 2
2 participants
You can’t perform that action at this time.