-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Enable WASM debugging #17162
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
Enable WASM debugging #17162
Conversation
src/Components/Blazor/Server/src/MonoDebugProxy/ws-proxy/DebugStore.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to demo this feature during the blazor sync up?
{ | ||
var request = context.Request; | ||
var requestPath = request.Path; | ||
if (requestPath.StartsWithSegments("/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rynowak could this be changed to use endpoint routing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be, but that's a big user-experience change. Let's not blocks this PR on that.
src/Components/Blazor/Server/src/MonoDebugProxy/BlazorMonoDebugProxyAppBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Components/Blazor/Server/src/MonoDebugProxy/BlazorMonoDebugProxyAppBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
Update. |
src/Components/Blazor/Server/src/MonoDebugProxy/BlazorMonoDebugProxyAppBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Components/Blazor/Server/src/MonoDebugProxy/BlazorMonoDebugProxyAppBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
… Chrome protocol Hacky so far. This is just a proof-of-concept.
c38ca64
to
4b8f293
Compare
🆙📅 |
if (requestPath.StartsWithSegments("/json") | ||
&& !request.Headers.ContainsKey("User-Agent")) | ||
{ | ||
var debuggerHost = "http://localhost:9222"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we might need to make this port number (and possibly hostname) configurable, but hopefully we will only do that if we find out it's necessary for tooling (e.g., if VS really wants to launch the browser with a nonstandard debugging port). So I'm OK with this as-is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we might need to make this port number (and possibly hostname) configurable
Wouldn't this fit in launchSettings
? I don't know if VS actually picks an unused port to launch IIS Express or simply picks any at random (and might randomly fail), but that seems semantically related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chucker This is the port that the browser listens on for debugging, not the port your app runs on. So the correct value depends on how you (or the IDE) started up your browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we've learned now thanks to a meeting with VS and web tools people that we do need to make this into a parameter. We're thinking it should be an environment variable. So:
- If the environment variable
ASPNETCORE_WEBASSEMBLYDEBUGHOST
is set, we should use that value fordebuggerHost
. The value will be something likehttp://localhost:49573
as an example. - Otherwise we keep using
http://localhost:9222
Do you think that's a change we could include in this PR?
Update: Sorry @pranavkm for notifying you last time. I got mixed up about which PR this was. I know you're not doing this one!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
@SteveSandersonMS can I get you to give one last review to just the latest commit since I had to change behavior somewhat? |
Fixes #13902.
Most of this code is from @SteveSandersonMS, I basically only merged it into the blazor-wasm branch, fixed merge problems, then @ajaybhargavb and I proved that it can work.
This currently works with VSCode (with the Chrome Debugging extension) and VS (through a multi-step process of attaching to the process). It does NOT work on the "F5 experience", but my understanding is that that's a tooling issue on the VS side.
Steps for running through this in VSCode:
CC @danroth27