Repository navigation
Fix Visual Studio debugging for Azure Functions projects - #22346
Conversation
Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22346Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22346" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The fallback can bypass the Functions host in some extension-owned or detached sessions and drop --useHttps when adding a port, leaving an HTTPS endpoint backed by HTTP.
2 open issues
What changed in this PR
Adds an Azure Functions-specific compatibility route to Aspire’s launch policy so Visual Studio can own project debugging and load breakpoint symbols.
Changes:
- Allow native
projectlaunch when advertised and no Aspire extension endpoint is configured. - Add routing tests for the Visual Studio fallback, missing project support, and unrelated custom launch types.
- Clarify the test comment describing capability-less IDE sessions.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/DebugSupportExtensionsTests.cs | Clarifies a comment about implicit legacy project support. |
| tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs | Adds positive and negative launch-routing regression tests. |
| src/Aspire.Hosting/Dcp/ExecutableLaunchPolicy.cs | Adds the gated Azure Functions native-project fallback. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
There was a problem hiding this comment.
🟡 Changes recommended
The fallback misclassifies extension-owned VS Code sessions without ASPIRE_EXTENSION_ENDPOINT, routing Azure Functions to the ordinary project debugger instead of process execution and potentially starting the worker without its Functions host.
3 open issues
Review effort: Max
Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Launch-policy regressions drop required tool prefixes and Functions launch-profile arguments, while incorrect debug-support reporting for project overrides can cause callbacks to omit arguments needed for process execution.
3 open issues
3 resolved since last review
Review effort: Max
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]>
PR testing report: #22346Overall resultThe scoped Windows functional tests passed, including debugging a real Azure Function in real Visual Studio. The function-handler source breakpoint bound and hit, and continuing returned the expected HTTP response. Targeted source tests completed with 592 passed, 8 platform-related skips, and 0 failures. This is not an all-platform or merge-readiness certification. One GitHub CI check remains failed, HTTPS certificate-chain trust was not validated, and the negative certificate case exposed a diagnostic limitation described below. PR information
The PR head was re-read at completion and still matched the tested commit. Artifact version verificationVerified. The standard PR dogfood installer installed an isolated CLI and package hive. The installed binary reported The actual Visual Studio-launched AppHosts recorded the same informational version from the loaded The source-test checkout was also at the exact PR head. The session branch was restored after testing without repository source modifications. Changes analyzedHosting launch policy and argument handling changed; CLI commands, dashboard UI, templates, client components, VS Code extension source, and CI infrastructure did not change.
Environment and prerequisite resolutionThe test solutions used a real .NET 10 isolated-worker Functions project:
All Aspire references came from the exact PR package hive. Fresh-app external restores used Visual Studio Functions toolingThe installed IDE was current, but its selected Functions toolset was not. Initially, the Functions resource received an IDE HTTP 500. Running the Functions project directly in the same real Visual Studio instance, without Aspire, produced: The selected cache was release The updated per-user Visual Studio Functions toolset was retained. No certificate trust stores were modified. Repository SDK bootstrapThe required initial restore was attempted: .\restore.cmd /p:Projects=tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj /p:SkipNativeBuild=trueIt failed while extracting the downloaded SDK. The machine already had the exact pinned SDK, Test scenarios executed1. Debug-support and DCP source regression testsCoverage: capability routing, launch policy, argument handling, negative/boundary cases. Result: 372 passed, 1 Linux-only skip. dotnet test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile -p:SkipNativeBuild=true '-p:DotNetTool=C:\Program Files\dotnet\dotnet.exe' '-p:DotNetRoot=C:\Program Files\dotnet\' -- --filter-class '*.DebugSupportExtensionsTests' --filter-class '*.DcpExecutorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'The passing matrix includes native Visual Studio compatibility, authoritative Aspire-extension capability lists with and without an extension endpoint, missing project capability, unrelated custom launch types, force-process/persistent behavior, project command overrides, and fixed/dynamic HTTPS launch-profile argument preservation. Evidence: 2. Affected .NET project source regression testsCoverage: project launch arguments and build coordination. Result: 220 passed, 7 filesystem/platform-related skips. dotnet test --project tests\Aspire.Hosting.Dotnet.Tests\Aspire.Hosting.Dotnet.Tests.csproj --no-launch-profile -p:SkipNativeBuild=true '-p:DotNetTool=C:\Program Files\dotnet\dotnet.exe' '-p:DotNetRoot=C:\Program Files\dotnet\' -- --filter-class '*.DotnetProjectResourceTests' --filter-class '*.DotnetProjectBuildCoordinatorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'All filtering used Microsoft.Testing.Platform switches. Quarantined and outerloop tests were excluded. Snapshot/source files were checked afterward; the repository remained clean. Evidence: 3. Real Visual Studio F5 and an actual Azure Function breakpointCoverage: primary user-visible fix. Result: passed. A fresh solution was generated by the installed PR CLI using the PR's .NET empty template. The solution contained the real Functions worker, its generated The real IDE's {
"supported_launch_configurations": ["project", "browser"]
}The AppHost recorded declared An HTTP request hit the source breakpoint in the real worker:
Continuing in Visual Studio completed the request: {
"marker": "pr22346-real-azure-functions",
"name": "visual-studio-f5",
"processId": 31364,
"debuggerAttached": true,
"framework": ".NET 10.0.15"
}This was neither a console-project stand-in nor a mock debug-session endpoint. The screenshot shows the real IDE stopped on the function-handler source line with the worker process and request visible. Visual Studio's Stop Debugging command subsequently ended the recorded AppHost, Functions host/worker, and API processes. Evidence: 4. Real Visual Studio fixed-port HTTPS with AppHost argumentsCoverage: profile arguments must survive a non-empty compatibility invocation. Result: passed for HTTPS functionality and debugger attachment. The profile specified The recorded effective arguments were exactly:
Evidence: 5. Real Visual Studio dynamically allocated HTTPS portCoverage: injected port arguments must not replace the profile's HTTPS/verbose arguments. Result: passed for HTTPS functionality and debugger attachment. The profile specified The allocated public endpoint was Evidence: HTTPS qualification for scenarios 4 and 5: Functions generated a local self-signed certificate. The initial normal curl request rejected its untrusted chain. Functional HTTPS requests then used 6. Real Visual Studio Ctrl+F5Coverage: native IDE launch without debugger attachment. Result: passed. A separate fresh solution was started through the real IDE's The Functions endpoint on port Evidence: 7. CLI-managed Functions fallback, ordinary API, and restartCoverage: behavior outside an IDE, plus lifecycle recovery. Result: passed. A separate fresh solution was started with the exact PR CLI, the template's secured HTTPS AppHost profile, and current Core Tools on the process-local PATH: & $cliPath start --apphost $appHost --launch-profile https --no-build --format Json --non-interactive
& $cliPath wait functions --status up --timeout 90 --apphost $appHost --non-interactive
& $cliPath resource functions restart --apphost $appHost --non-interactive
& $cliPath stop --apphost $appHost --non-interactive
The AppHost recorded no active debug session and Evidence: 8. Invalid certificate arguments under real Visual StudioCoverage: visible startup error rather than a false-running function. Result: expected stopped/error behavior observed, with a diagnostic limitation. The profile supplied: The password is a dummy test value, not a credential. Supplying it ensures the explicit certificate path is used. Core Tools logged: The Functions resource stopped in Diagnostic limitation: the native IDE path did not expose a non-zero process exit code here, and the resource was not labeled Evidence: Summary
CI status and unvalidated scopeAt completion, GitHub reported 344 successful checks, 13 skipped checks, and 1 failed check at the tested head. The remaining failure is Native AOT, generated SDK, Docker, DCP, CLI and Dashboard. It was already failing when testing began and was not diagnosed or rerun as part of this local exercise. These local results do not clear that CI failure. This exercise did not run Linux/macOS scenarios, a real VS Code Extension Host, or separate Java/Blazor end-to-end applications. Extension capability fallback was covered by source tests, not by a claim of real VS Code execution. Evidence and cleanupScreenshots, structured results, exact fixture source, automation scripts, and selected logs are preserved with this report in the Copilot session artifacts. The primary evidence is Cleanup was verified at 13:17:15 PST:
Evidence: |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because an Azure Functions launch compatibility edge case can prevent IDE debugging and leave breakpoints unloaded.
No open issues 🎉
5 resolved since last review
Honor advertised launch types when selecting IDE execution Cover dynamic HTTPS for sessions without debug session info Return null when TryGetIdeLaunchAnnotation fails Ownership inspection misclassifies synthesized project annotations Public API addition and deprecation are missing from the checklist
Review effort: Max
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Debug sessions without supported_launch_configurations incorrectly route unrelated custom project types through the native launcher and can drop launch-profile arguments.
1 open issue
1 resolved since last review
Review effort: Max
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]>
Tests selector52 / 101 PR test projects · 4 PR jobs, from 11 changed files. Selected PR test projects (52 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 46
🧪 📦 affected project 📦 affected project 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because missing AppHost build configuration in Azure Functions compatibility launches could cause a Release AppHost to run Debug output.
No open issues 🎉
1 resolved since last review
Review effort: Max
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
PR Testing ReportPR Information
Artifact Version Verification
The Windows archive was initially unavailable because its CI job was still building. The installer succeeded once it was published. Initial fixture scaffolding used the CLI built from the exact source checkout and the downloaded PR templates; an additional fresh-project smoke test used the verified native PR CLI and its installed hive. Preliminary IDE checks using the existing stable bundle were repeated with the PR bundle, and the final results below refer to those repeated runs. Environment
No Azure deployment or private cloud resources were used. The Functions integration configured its default local host-storage emulator against the available Docker engine; emulator readiness was not independently asserted. Neither npm nor Python packages were needed. The fixture intentionally used a project-based AppHost and Changes Analyzed
Categories: Hosting and tests. No CLI implementation, Dashboard UI, template, client integration, VS Code extension, or CI workflow changes. Test Scenarios Executed1. Verified native dogfood installation and fresh project creationCoverage: Artifact identity and CLI/template smoke test. Installed using the PR's dogfood PowerShell script with Created a separate & $cliPath new aspire-empty --name DogfoodSmoke --output "$testDir\DogfoodSmoke" --source $hivePath --version 17.1.0-pr.22346.gadd2204d --language csharp --localhost-tld false --suppress-agent-init --use-config-source false --non-interactiveHere Evidence: 2. Actual Azure Functions debugging in real Visual StudioCoverage: User-visible end-to-end happy path. Created a fresh Aspire application containing an actual .NET isolated-worker Azure Functions project with an anonymous HTTP trigger. It was not an ASP.NET stand-in with a substituted launch annotation. An STA COM automation harness started the installed An HTTP request to The debugged-process inventory contained both the AppHost and the actual isolated Functions worker. The Debug output explicitly confirmed: Continuing execution completed the request with: No manual attach, capability override, or forced replacement of the Functions launch type was used. Evidence: 3. Functions profile arguments, AppHost arguments, and stop/restartCoverage: Argument boundary and lifecycle recovery. The Function launch profile specified This verifies the launch-profile port was not discarded when AppHost arguments were supplied. Stopped debugging through Visual Studio and invoked F5 again in the same IDE session. The worker PID changed from Evidence: Both cycle entries in 4. Ordinary ASP.NET project debugging regressionCoverage: Separate user-visible end-to-end regression scenario. Created another fresh Aspire application with a normal ASP.NET project. In real Visual Studio with the PR bundle selected, F5 automatically debugged the web project. An HTTP request hit its source breakpoint at Evidence: 5. Focused source regression tests, including negative/boundary coverageCoverage: Automated source tests at the exact PR head. Ran from the PR checkout: dotnet test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class "*.DebugSupportExtensionsTests" --filter-class "*.ExecutableLaunchPlanTests" --filter-class "*.ResourceSnapshotBuilderTests" --filter-class "*.DcpExecutorTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"The selected classes covered:
The skipped test was Evidence: Summary
Overall ResultPR VERIFIED for the tested Windows / Visual Studio Enterprise 2026 Insiders scenarios. No product failures found. The key reported regression is directly exercised: an actual Azure Functions worker automatically became a Visual Studio debug target, loaded its symbols, and hit a Function breakpoint without manual attachment. Coverage boundaries and observations
Artifacts and CleanupThe report, debugger screenshots, JSON process inventories, debugger output, CLI logs, version/provenance records, and The ZIP preserves 29 source/configuration files from the three freshly generated fixtures without build outputs or Visual Studio user state. All harness-owned IDE/debug sessions and generated applications were stopped. No running fixture containers remained. The temporary application workspace was deleted, and the original session branch was restored with no repository file changes. Downloaded test installations/packages were removed after preserving their identity records. No repository changes were committed or pushed. |
d6892bf
into
main
|
✅ No documentation update needed. Branch: proven false positive on
|
|
/backport to release/17.0 |
|
Started backporting to |
…ts (#22401) Backport of #22346 to release/17.0 /cc @karolz-ms ## Customer Impact ## Testing ## Risk ## Regression? --------- Co-authored-by: Karol Zadora-Przylecki <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>


Description
Visual Studio 2026 advertises native
projectlaunch support but not the VS Code-specificazure-functionslaunch type. Aspire previously treated that missing custom capability as an exact rejection and launched Azure Functions through DCP process execution, so Visual Studio did not own the Functions process and project breakpoints could not load symbols.This change uses the legacy
projectcompatibility launch only for Azure Functions projects when the IDE advertises native project support and the session is not owned by an Aspire extension. Extension-managed sessions continue to treat their advertised custom launch types as an exact contract.Regression coverage verifies the Visual Studio fallback, the VS Code process fallback, IDEs without project support, and unrelated custom launch types.
Validation:
DcpExecutorTests: 332 passed, 1 platform-specific test skipped.azure-functionslaunch type hit its breakpoint through the nativeprojectcompatibility launch.Fixes #22242
Checklist
<remarks />and<code />elements on your triple slash comments?