Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamint
Copy link
Member

@adamint adamint commented Nov 12, 2025

Description

A lack of check for the presence of SupportsDebuggingAnnotation meant that children of ProjectResource were being launched via IDE. This bug also affects dev kit, where functions apps are successfully launched via the IDE but with no console output. The fix is to only run a project executable in IDE execution mode if it contains that annotation.

In addition, one AddProject overload did not have the required WithDebugSupport call, meaning it needs to be added so that all project resources still continue to be run via the IDE.

Lastly, I did not update the debug support capability for project resources from the c# extension id to project. This has no effective implications for the extension, but is incorrect.

To test, you can run the functions playground app, an app containing a python resource (such as python), and any other app that contains project resources. I have tested both command-line run and through the VS Code extension to confirm that this fix works.

Needs backport.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@adamint adamint self-assigned this Nov 12, 2025
@adamint adamint requested a review from mitchdenny as a code owner November 12, 2025 20:50
Copilot AI review requested due to automatic review settings November 12, 2025 20:50
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

🚀 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 -- 12939

Or

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

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 fixes three related issues with extension support for project resources:

  1. Critical bug fix: Resources inheriting from ProjectResource without SupportsDebuggingAnnotation were incorrectly being launched via IDE, causing issues like missing console output in Functions apps
  2. Missing annotation: The generic AddProject<TProject> overload with Action<ProjectResourceOptions> was missing the required WithDebugSupport call
  3. Incorrect capability ID: Updated from "ms-dotnettools.csharp" to "project" in three locations

Key Changes

  • Added annotation check in DcpExecutor.PrepareProjectExecutables() to only use IDE execution mode for projects with SupportsDebuggingAnnotation
  • Added WithDebugSupport call to the generic AddProject<TProject> overload to ensure all project resources get debugging support
  • Updated capability IDs from "ms-dotnettools.csharp" to "project" for consistency

Reviewed Changes

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

Show a summary per file
File Description
src/Aspire.Hosting/Dcp/DcpExecutor.cs Added check for SupportsDebuggingAnnotation before using IDE execution type
src/Aspire.Hosting/ProjectResourceBuilderExtensions.cs Added missing WithDebugSupport call and corrected capability IDs to "project"
src/Aspire.Hosting/SupportsDebuggingAnnotation.cs Minor whitespace cleanup
tests/Aspire.Hosting.Tests/ProjectResourceTests.cs Added tests verifying all project builder methods add SupportsDebuggingAnnotation
tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs Added test verifying projects without annotation run in Process mode

&& !string.IsNullOrEmpty(_configuration[DebugSessionPortVar])
&& supportedLaunchConfigurations is not null
&& supportedLaunchConfigurations.Contains(supportsDebuggingAnnotation.LaunchConfigurationType))
if (executable.SupportsDebugging(_configuration, out var supportsDebuggingAnnotation))
Copy link
Member Author

@adamint adamint Nov 13, 2025

Choose a reason for hiding this comment

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

there were like 3 implementations of this logic, it is all now encapsulated in ExtensionUtils.SupportsDebugging and accurately tested. eliminates a possible source of bugs

@davidfowl
Copy link
Member

Unrelated bu I am curious what it would take to do on demand debugging via a command.

@adamint
Copy link
Member Author

adamint commented Nov 13, 2025

Unrelated bu I am curious what it would take to do on demand debugging via a command.

I've been gaming this scenario out. We can model the debugger as a child resource that does not start automatically, as unlike with a command, you only need to attach once.

@davidfowl
Copy link
Member

Why would it need to be a child resource?

@adamint
Copy link
Member Author

adamint commented Nov 13, 2025

Why would it need to be a child resource?

A debugger has two clear states: attached and not attached, which can map to running and waiting. You can also show the (perhaps complicated) details in the details panel . You also realistically only have one debugger attached to a given resource at a time**. And, a resource that automatically starts is an advantage over commands in scenarios like browser debugging, where you may want to automatically spin up a debug instance of chrome/edge/firefox.

It's late so that's written poorly, sorry. The idea is that you would only need to create a new resource, call this updated WithDebugSupport method that offers you the freedom to set whatever debugger properties you want in the launchConfigurationProducer by using a launch configuration class that inherits from ExecutableLaunchConfigurationWithDebuggerProperties. That's how I implemented a JS frontend debugger resource.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants