Add projectPath and launchBrowser options to blazorwasm debug configuration#9427
Open
LittleLittleCloud wants to merge 2 commits into
Open
Add projectPath and launchBrowser options to blazorwasm debug configuration#9427LittleLittleCloud wants to merge 2 commits into
LittleLittleCloud wants to merge 2 commits into
Conversation
…ration - Introduced projectPath to specify the .csproj file for target framework detection. - Added launchBrowser option to control browser launch behavior during debugging. - Updated BlazorDebugConfigurationProvider to utilize new configuration properties.
davidwengier
approved these changes
Jun 12, 2026
Member
There was a problem hiding this comment.
I'm guessing this wasn't intended to be committed, but if it was, perhaps as a readme.md in the blazorDebug folder might be better?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blazor WebAssembly Browser Debug Control
Summary
Expose the project path directly on the existing
blazorwasmdebug configuration so callers can launch browser and WebAssembly debugging for an already-running app without composing low-level debug adapter configurations. Also allowblazorwasmlaunch configurations to start only the app process by disabling browser launch.The motivating integration is the Aspire browser launch command described in Aspire Extension: Browser and WASM debug session support. Aspire can receive a browser launch request for an already-running app and needs VS Code to start browser JavaScript debugging plus Blazor WebAssembly managed debugging. The Aspire extension should be able to invoke the existing high-level
blazorwasmdebug type instead of composing js-debug,monovsdbg_wasm, VSDbg bridge ports, and cascade termination behavior itself.Current Behavior
The existing
BlazorDebugConfigurationProviderowns the detailed Blazor orchestration:request: "launch";launchSettings.jsonforinspectUriandapplicationUrl;Today
launchBrowsercallsuseVSDbgwith a value derived fromcwd. That is incorrect for callers such as Aspire, where the browser launch command can provide the.csprojpath independently from the web root or working directory. Target framework detection should use a project path, not the launch working directory.Proposed Schema
Add
projectPathtoblazorwasmattach configurations:{ "name": "C#: Launch Blazor Browser Only", "type": "blazorwasm", "request": "attach", "projectPath": "${workspaceFolder}/Client/Client.csproj", "url": "https://localhost:5001", "browser": "edge" }The existing request semantics already cover the key modes:
request: "launch": start the app and browser/WASM debugging by default.request: "attach": start browser/WASM debugging only against an already-running app.For app-only scenarios, callers can use
request: "launch"with browser launch disabled:{ "name": "C#: Launch both app and browser", "type": "blazorwasm", "request": "launch", "projectPath": "${workspaceFolder}/Client/Client.csproj", "browser": "edge", "launchBrowser": true } { "name": "C#: Launch Blazor App Only", "type": "blazorwasm", "request": "launch", "projectPath": "${workspaceFolder}/Client/Client.csproj", "url": "https://localhost:5001", "launchBrowser": false } { "name": "C#: Attach debugging browser", "type": "blazorwasm", "request": "attach", "projectPath": "${workspaceFolder}/Client/Client.csproj", "url": "https://localhost:5001", "browser": "edge" }Aspire Mapping
Aspire browser launch data should map into the existing
blazorwasmsurface:urlmaps tourl.projectPathwhen it identifies a.csproj.web_rootmaps towebRootwhen it identifies a static web root.browser.Implementation Notes
BlazorDebugConfigurationProvider.launchBrowsershould resolveconfiguration.projectPathand pass that value touseVSDbg. It may fall back tocwdfor compatibility with existing launch configurations, butcwdshould no longer be the primary input for target framework detection.useVSDbgalready accepts either a.csprojfile path or a directory, becausefindCsprojFileshandles both forms. Passing the actual project path fixes .NET 9+ detection for integrations wherecwdis not the project file or project directory.BlazorDebugConfigurationProvider.resolveDebugConfigurationshould skiplaunchBrowserwhenconfiguration.launchBrowser === false. This keeps the existing launch path but allows callers to useblazorwasmfor app-only launch when they intentionally do not want browser or WASM debug sessions.