Skip to content

Fix 13.2 IDE execution regressions for Azure Functions and class library projects#15714

Merged
adamint merged 22 commits intomicrosoft:mainfrom
adamint:dev/adamint/dcpexecutor-bugs
Apr 1, 2026
Merged

Fix 13.2 IDE execution regressions for Azure Functions and class library projects#15714
adamint merged 22 commits intomicrosoft:mainfrom
adamint:dev/adamint/dcpexecutor-bugs

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented Mar 30, 2026

Description

Fixes regressions introduced in Aspire 13.2 where project resources using custom debug types (Azure Functions, AWS Lambda class libraries) or added via AddResource without WithDebugSupport no longer received IDE execution in Visual Studio or VS Code, breaking debugging and symbol loading.

In DcpExecutor.PrepareProjectExecutables(), adds a fallback branch that provides IDE execution with a standard ProjectLaunchConfiguration when in a debug session but either no SupportsDebuggingAnnotation exists (e.g. AddResource-based ProjectResource subclasses) or the IDE did not send DEBUG_SESSION_INFO (Visual Studio scenario where VS handles all project types natively). This restores pre-13.2 behavior.

In the VS Code extension, adds support for Executable command launch profiles used by AWS Lambda. When the launch profile specifies commandName: "Executable" with an executablePath, the extension builds the project and uses the profile's executable path as the debug program instead of the project output DLL.

Includes a ProjectResourceExtensions playground app for manual E2E validation of standard, custom-debug, Azure Functions, and class library project types.

Fixes #15606
Fixes #15647
Fixes #15378
Fixes #15699

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?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15714

Or

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

@adamint adamint force-pushed the dev/adamint/dcpexecutor-bugs branch from 679f3a1 to 35242ef Compare March 31, 2026 17:22
@adamint adamint changed the title test fix 13.2 projectresource subclass regressions Mar 31, 2026
adamint and others added 15 commits March 31, 2026 15:07
…rojects

- ExtensionUtils: treat 'project' launch type as implicitly supported by DCP,
  so standard projects get IDE execution even when VS Code extension sends
  SupportedLaunchConfigurations without 'project' (microsoft#15606, microsoft#15647)

- DcpExecutor: add else-if branch for VS scenario (DEBUG_SESSION_PORT set,
  no DEBUG_SESSION_INFO) so projects with non-'project' annotations like
  'azure-functions' still get IDE execution with ProjectLaunchConfiguration
  fallback (microsoft#15378)

- Add 8 unit tests covering VS, VS Code, and CLI scenarios
- Add IdeDebuggingRepro playground for manual verification
…rojects

- ExtensionUtils: treat 'project' launch type as implicitly supported by DCP, so
  standard projects get IDE execution even when VS Code extension sends
  SupportedLaunchConfigurations without 'project' (microsoft#15606, microsoft#15647)
- DcpExecutor: add else-if branch for VS scenario (DEBUG_SESSION_PORT set, no
  DEBUG_SESSION_INFO) so projects with non-'project' annotations like
  'azure-functions' still get IDE execution with ProjectLaunchConfiguration
  fallback (microsoft#15378). Also handles ProjectResource subclasses added via
  AddResource without WithDebugSupport (e.g. AWS Lambda) (microsoft#15606)
- Extension dotnet.ts: handle Executable command launch profiles (e.g. AWS
  Lambda) by using the profile's executablePath instead of the project output
  DLL, which fails for class library projects (microsoft#15647)
- Add 10 hosting unit tests covering VS, VS Code, and CLI scenarios
- Add extension test for Executable launch profile handling
- Add IdeDebuggingRepro playground for manual verification
- Add FakeIntegrationLibrary class-library project with Executable launch profile
- Add fake ProjectResource subclass integration added via AddResource (no WithDebugSupport)
- Wire fake integration into IdeDebuggingRepro.AppHost for manual validation of:
  - microsoft#15606 (ProjectResource subclass without debug annotation)
  - microsoft#15647 (Executable launch profile handling in VS Code extension)
  - microsoft#15378 (existing custom non-project debug type scenario remains)
- Rename playground folder and AppHost project to ProjectResourceExtensions
- Add AzureFunctionsService to validate VS Azure Functions debugging scenario (microsoft#15378)
- Keep fake ProjectResource subclass integration and Executable launch-profile
  scenario for microsoft#15606 and microsoft#15647 manual E2E validation
- Validate renamed AppHost builds successfully
The class library OutputType caused VS to hang — DCP sets ExecutionType.IDE
but VS can't launch a Library project and doesn't report failure, so DCP
waits indefinitely. Changed to Web SDK with a minimal Program.cs endpoint.
The empty {} caused the CLI/AppHost to fail because ASPNETCORE_URLS and
ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL were never set.
Both custom-debug-service and fake-integration-library defaulted to port
5000 since no endpoints were declared. Adding WithHttpEndpoint() lets DCP
assign dynamic ports.
AddResource doesn't call WithProjectDefaults, so ASPNETCORE_URLS was never
set and the app defaulted to port 5000. Added environment callback to
inject URLs from allocated endpoints, matching what AddProject does.
AddProject already creates a default http endpoint, so the extra
WithHttpEndpoint() caused a name collision.
…x port binding

- Move funcApp declaration before standardService to fix use-before-declare
- StandardService now references funcApp and exposes /call-functions endpoint
- FakeIntegrationLibrary reads PORT env var for dynamic port binding
- Add ServiceDefaults to StandardService for service discovery
Without launch profiles, Kestrel defaults to port 5000 which conflicts
with macOS AirPlay. Setting applicationUrl to port 0 lets the OS assign
a free port, and DCP overrides with ASPNETCORE_URLS when orchestrating.
- Fix != null to is not null in two test methods
- Add FallbackExecutionTypes assertions to fallback branch tests
- Add ProjectLaunchConfiguration assertion to VS scenario test
- Revert unintended xlf whitespace change

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adamint adamint force-pushed the dev/adamint/dcpexecutor-bugs branch from d598a1d to 72da4f1 Compare March 31, 2026 19:09
@adamint adamint changed the title fix 13.2 projectresource subclass regressions Fix IDE execution regressions for Azure Functions, AWS Lambda, and class library projects Mar 31, 2026
@adamint adamint changed the title Fix IDE execution regressions for Azure Functions, AWS Lambda, and class library projects Fix 13.2 IDE execution regressions for Azure Functions and class library projects Mar 31, 2026
@adamint adamint marked this pull request as ready for review March 31, 2026 20:09
@adamint adamint requested a review from mitchdenny as a code owner March 31, 2026 20:09
Copilot AI review requested due to automatic review settings March 31, 2026 20:09
Copy link
Copy Markdown
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

Fixes Aspire 13.2 regressions where certain project resources (custom debug types like Azure Functions / AWS Lambda class libraries, or AddResource-based ProjectResource subclasses without debug annotations) stopped getting IDE execution, breaking debugging/symbol loading in Visual Studio and VS Code.

Changes:

  • Restores IDE execution fallback behavior in DcpExecutor.PrepareProjectExecutables() for debug sessions when debug annotations are missing or when VS does not provide DEBUG_SESSION_INFO.
  • Updates the VS Code extension to support commandName: "Executable" launch profiles (e.g., AWS Lambda) by launching via executablePath instead of the project output DLL.
  • Adds targeted unit tests and a playground app for manual E2E validation of standard/custom/Azure Functions/class-library project cases.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs Adds/adjusts tests covering implicit "project" support, VS fallback behavior, and process fallback guards.
src/Aspire.Hosting/Utils/ExtensionUtils.cs Treats "project" launch configuration as implicitly supported in debug sessions.
src/Aspire.Hosting/Dcp/DcpExecutor.cs Adds IDE execution fallback branch to restore pre-13.2 behavior for projects in debug sessions.
extension/src/debugger/languages/dotnet.ts Supports Executable launch profiles by using executablePath as the launched program (and building the project).
extension/src/test/dotnetDebugger.test.ts Adds test coverage for Executable launch profile handling.
playground/ProjectResourceExtensions/** Adds a manual validation playground solution and sample projects.
Aspire.slnx Includes the new playground projects in the repo solution index.

- Remove unused standardService variable (CS0219)
- Add LaunchProfileCommandName consts with case-insensitive comparisons
- Remove unnecessary playground .sln file
- Extract ShouldFallBackToIdeExecution() method for readability
- Extract CreateProjectLaunchConfiguration() to deduplicate code
- Clarify comment about non-project launch config timing
@adamint adamint added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Apr 1, 2026
adamint and others added 6 commits March 31, 2026 23:57
When a launch profile uses commandName=Executable with executablePath=dotnet
and commandLineArgs starting with 'exec', the coreclr debugger needs the
target DLL as the program, not 'dotnet' itself. Parse the exec args to
extract the DLL path and application arguments so the debugger can properly
attach to Lambda class library functions.
For class library Lambda projects with commandName=Executable launch
profiles, skip IDE execution and use process execution with the launch
profile's command line args (dotnet exec ...) directly. This avoids the
issue where the coreclr debugger can't attach to a bare 'dotnet' host.

Also reverts the parseDotnetExecArgs approach in the extension since
these resources now run as processes rather than IDE-debugged sessions.
Two new tests:
- ProjectExecutable_NoAnnotation_ExecutableLaunchProfile_InDebugSession_RunsInProcessWithExecArgs:
  Verifies class library Lambda projects with Executable launch profiles get
  process execution with dotnet exec args
- ProjectExecutable_NoAnnotation_ProjectLaunchProfile_InDebugSession_RunsInIdeMode:
  Verifies normal Project launch profiles still get IDE execution
Remove arg parsing and variable expansion complexity. Instead, simply
exclude Executable command name profiles from IDE fallback in
ShouldFallBackToIdeExecution(), letting them fall through to the
standard process execution path (dotnet run).

Also remove AWS-specific language from all comments.
- Fix logical bug: determineWorkingDirectory now expands env vars (e.g.
  $(HOME)) before checking path.isAbsolute, preventing incorrect relative
  path resolution
- Fix inaccurate JSDoc on expandEnvironmentVariables (remove $VAR claim)
- Fix misleading comment about always using launch profile args
- Fix test comment grammar
- Add integration test for env var expansion in Executable profile paths
- Add negative assertion for empty project args in IDE fallback test
- Add tests for env var expansion in working directory resolution

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adamint
Copy link
Copy Markdown
Member Author

adamint commented Apr 1, 2026

I discovered a couple additional issues related to args handling in the vs code extension and behavior existing in VS that we should be replicating in VS Code (environment variable expansion).

I've tested these fixes with azure functions projects, lambda projects, and normal projects in both VS Code and VS as well as the CLI.

@adamint adamint removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Apr 1, 2026
@adamint adamint requested review from JamesNK and karolz-ms April 1, 2026 13:41
adamint added a commit to adamint/aspire that referenced this pull request Apr 1, 2026
@adamint adamint merged commit ca9e837 into microsoft:main Apr 1, 2026
256 checks passed
karolz-ms added a commit that referenced this pull request Apr 1, 2026
joperezr pushed a commit that referenced this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants