Skip to content

Conversation

@dkattan
Copy link

@dkattan dkattan commented Jan 15, 2026

Motivation

Aspire 13 improved debugging for child processes; this change extends that all the way to the browser. Before this PR, a serverReadyAction supplied on the Aspire launch config was overwritten by a hard-coded default:

{
	"action": "openExternally",
	"pattern": "\\bNow listening on:\\s+https?://\\S+",
	"uriFormat": "..."
}

That prevented browser breakpoint debugging and custom URL capture patterns. In this PR we honor the supplied serverReadyAction, so browser debugging can be triggered correctly (e.g., debugWithChrome / debugWithEdge) with a custom pattern and uriFormat.

Changes

  • Add a typed ServerReadyAction to DCP types and expose it on AspireExtendedDebugConfiguration.
  • Note that VS Code does not export ServerReadyAction and link to its canonical definition.
  • Centralize serverReadyAction inheritance/selection inside determineServerReadyAction.
  • Pass parentDebugConfiguration into determineServerReadyAction from the .NET debugger.
  • Update tests for the new behavior and URL-capture pattern.

Tests

  • launchProfiles.test.ts
  • dotnetDebugger.test.ts

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13930

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13930"

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 15, 2026
@dkattan
Copy link
Author

dkattan commented Jan 15, 2026

@dkattan please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

@dkattan dkattan marked this pull request as ready for review January 15, 2026 15:16
Copilot AI review requested due to automatic review settings January 15, 2026 15:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the serverReadyAction handling in the VS Code extension to honor user-specified server ready actions from the Aspire launch configuration, enabling browser debugger attachment (e.g., debugWithChrome, debugWithEdge) and custom URL patterns. Previously, a hard-coded default configuration would overwrite any user-supplied settings.

Changes:

  • Added ServerReadyAction type definition and exposed it on AspireExtendedDebugConfiguration
  • Refactored determineServerReadyAction to accept options and inherit from parent debug configuration
  • Updated pattern to use capture groups ((https?://\\S+)) for proper URL substitution with %s format

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
extension/src/dcp/types.ts Added ServerReadyAction type and parentDebugConfiguration field to LaunchOptions and AspireExtendedDebugConfiguration
extension/src/debugger/launchProfiles.ts Refactored determineServerReadyAction to accept options object and support parent configuration inheritance
extension/src/debugger/languages/dotnet.ts Updated call to determineServerReadyAction to pass parentDebugConfiguration from launchOptions
extension/src/test/launchProfiles.test.ts Updated tests to use new API and added cross-platform path handling
extension/src/test/dotnetDebugger.test.ts Updated assertions to match new serverReadyAction behavior with capture groups

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

export function determineServerReadyAction(
options: ServerReadyActionOptions = {}
): ServerReadyAction | undefined {
if (!options.launchBrowser) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we actually gate this on launchSettings.json's launchBrowser property?

launchSettings.json (IMO) is a relic from Visual Studio

launch.json (IMO) is the "VS Code" way

I know that's an over-simplification and that we are conceptually layering them so launch.json -> launchSettings.json -> target project

I guess my point is it took me a while to realize that both applicationUrl and launchBrowser both needed to be specified before I could have the privilege of using the hardcoded serverReadyAction.

I don't want other VS Code purists to get frustrated that their serverReadyAction isn't working because a setting for Visual Studio isn't specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant