WithBrowserDebugger: no-op when IDE lacks browser capability#15400
Open
adamint wants to merge 2 commits intomicrosoft:release/13.2from
Open
WithBrowserDebugger: no-op when IDE lacks browser capability#15400adamint wants to merge 2 commits intomicrosoft:release/13.2from
adamint wants to merge 2 commits intomicrosoft:release/13.2from
Conversation
- Rename ValidateBrowserCapability to HasBrowserCapability (returns bool) - WithBrowserDebugger early-returns when DEBUG_SESSION_INFO is missing or doesn't include 'browser' capability, instead of always creating the child resource - Update existing tests to set DEBUG_SESSION_INFO with browser capability - Add tests for no-op behavior and unsupported capability error
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15400Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15400" |
adamint
commented
Mar 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates JavaScript hosting’s WithBrowserDebugger behavior so it doesn’t create a BrowserDebuggerResource unless the IDE indicates browser debugging support via DEBUG_SESSION_INFO, and adjusts tests accordingly.
Changes:
- Make
WithBrowserDebuggerearly-return (no-op) when browser capability isn’t available (HasBrowserCapability). - Rename/reshape the capability check from
ValidateBrowserCapability(void) toHasBrowserCapability(bool) and keep throwing when capability info is present but lacks"browser". - Update/add unit tests to set
DEBUG_SESSION_INFOwhere required and to cover the no-op case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs |
Adds capability gating for WithBrowserDebugger via HasBrowserCapability and updates docs. |
tests/Aspire.Hosting.JavaScript.Tests/AddNodeAppTests.cs |
Updates existing browser debugger tests to set DEBUG_SESSION_INFO and adds new tests for no-op/throw cases. |
…es, update docs, rename test
This was referenced Mar 19, 2026
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.
Description
WithBrowserDebuggerpreviously always created aBrowserDebuggerResourcechild resource, even when the IDE didn't support browser debugging (i.e.,DEBUG_SESSION_INFOwas not set or didn't include"browser"insupported_launch_configurations). This caused unnecessary resources to be created.This change makes
WithBrowserDebuggera no-op when the IDE lacks browser capability:ValidateBrowserCapability→HasBrowserCapability(returnsboolinstead ofvoid)WithBrowserDebuggerearly-returns without creating the child resource whenHasBrowserCapabilityreturnsfalseInvalidOperationExceptionwhenDEBUG_SESSION_INFOis present but doesn't list"browser"capabilityTesting
DEBUG_SESSION_INFOwith browser capabilityViteApp_WithBrowserDebugger_NoOps_WhenDebugSessionInfoNotSet— verifies no child resource when config is absentViteApp_WithBrowserDebugger_NoOps_WhenBrowserCapabilityNotListed— verifies exception when config exists but browser isn't listedChecklist