Fix 13.2 IDE execution regressions for Azure Functions and class library projects#15714
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15714Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15714" |
679f3a1 to
35242ef
Compare
…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>
d598a1d to
72da4f1
Compare
There was a problem hiding this comment.
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 provideDEBUG_SESSION_INFO. - Updates the VS Code extension to support
commandName: "Executable"launch profiles (e.g., AWS Lambda) by launching viaexecutablePathinstead 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. |
playground/ProjectResourceExtensions/ProjectResourceExtensions.AppHost/AppHost.cs
Outdated
Show resolved
Hide resolved
playground/ProjectResourceExtensions/ProjectResourceExtensions.sln
Outdated
Show resolved
Hide resolved
- 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
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>
|
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. |
… Functions and class library projects (microsoft#15714)
Description
Fixes regressions introduced in Aspire 13.2 where project resources using custom debug types (Azure Functions, AWS Lambda class libraries) or added via
AddResourcewithoutWithDebugSupportno 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 standardProjectLaunchConfigurationwhen in a debug session but either noSupportsDebuggingAnnotationexists (e.g.AddResource-basedProjectResourcesubclasses) or the IDE did not sendDEBUG_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
Executablecommand launch profiles used by AWS Lambda. When the launch profile specifiescommandName: "Executable"with anexecutablePath, the extension builds the project and uses the profile's executable path as the debug program instead of the project output DLL.Includes a
ProjectResourceExtensionsplayground 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
<remarks />and<code />elements on your triple slash comments?aspire.devissue: