Skip to content

Fix Visual Studio debugging for Azure Functions projects - #22346

Merged
Karol Zadora-Przylecki (karolz-ms) merged 6 commits into
mainfrom
dev/karolz-ms/issue-22242
Nov 18, 2026
Merged

Karol Zadora-Przylecki (karolz-ms) merged 6 commits into
mainfrom
dev/karolz-ms/issue-22242

Conversation

@karolz-ms

@karolz-ms Karol Zadora-Przylecki (karolz-ms) commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Visual Studio 2026 advertises native project launch support but not the VS Code-specific azure-functions launch 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 project compatibility 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:

  • Focused launch-routing tests: 6 passed.
  • DcpExecutorTests: 332 passed, 1 platform-specific test skipped.
  • Visual Studio 18.13 Insiders F5 check against this branch: a source-backed project using the unsupported azure-functions launch type hit its breakpoint through the native project compatibility launch.

Fixes #22242

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

@github-actions

Copy link
Copy Markdown
Contributor

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

Or

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

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 16, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 16, 2026 23:16
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 project launch 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

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@aspire-repo-bot
aspire-repo-bot Bot requested a max review from Copilot November 17, 2026 20:02
@karolz-ms

Copy link
Copy Markdown
Contributor Author

Posting note: This report covers tested commit 163a9a8. The PR has since advanced to be1e6d9; that newer head has not been tested in this run.

PR testing report: #22346

Overall result

The 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

Field Value
PR #22346: Fix Visual Studio debugging for Azure Functions projects
Tested head 163a9a804b322fc22c6454e3469a69d760601f51
PR CLI/package version 17.1.0-pr.22346.g163a9a80
Test date 2026-11-17, Pacific Standard Time, GMT-8
Final cleanup verification 13:17:15 PST
Execution target Local Windows host, fresh temporary solutions
IDE Visual Studio Enterprise 2026 Insiders, 18.13.12412.241

The PR head was re-read at completion and still matched the tested commit.

Artifact version verification

Verified. The standard PR dogfood installer installed an isolated CLI and package hive. The installed binary reported 17.1.0-pr.22346.g163a9a80.

The actual Visual Studio-launched AppHosts recorded the same informational version from the loaded Aspire.Hosting.dll, with the assembly located in each generated AppHost's output directory. This was not testing an installed stable hosting package or a simulated Visual Studio endpoint.

The source-test checkout was also at the exact PR head. The session branch was restored after testing without repository source modifications.

Changes analyzed

Hosting launch policy and argument handling changed; CLI commands, dashboard UI, templates, client components, VS Code extension source, and CI infrastructure did not change.

Changed file Relevant behavior
src/Aspire.Hosting/ApplicationModel/DebugSupportExtensions.cs Effective IDE launch selection, Azure Functions compatibility, extension capability contract
src/Aspire.Hosting/ApplicationModel/ExecutableLaunchRecipe.cs Preserving profile arguments when compatibility launch arguments are materialized
src/Aspire.Hosting/Dcp/ExecutableLaunchPolicy.cs IDE versus process ownership and compatibility decisions
src/Aspire.Hosting/SupportsDebuggingAnnotation.cs Updated helper reference
src/Aspire.Hosting.Dotnet/DotnetProjectHostingExtensions.cs Consuming the effective IDE launch annotation
src/Aspire.Hosting.Blazor/BrowserDebuggerHelper.cs Consuming the effective IDE launch annotation
src/Aspire.Hosting.Java/JavaHostingExtensions.cs Consuming the effective IDE launch annotation
tests/Aspire.Hosting.Tests/DebugSupportExtensionsTests.cs Debug-support decision regression coverage
tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs Launch routing, profile arguments, and process-override coverage
tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj Azure Functions hosting test reference
tests/Aspire.Hosting.Dotnet.Tests/DotnetProjectResourceTests.cs Effective-launch helper coverage
tests/Aspire.Hosting.Dotnet.Tests/DotnetProjectBuildCoordinatorTests.cs Effective-launch helper coverage

Environment and prerequisite resolution

The test solutions used a real .NET 10 isolated-worker Functions project:

  • Microsoft.Azure.Functions.Worker 2.52.0.
  • Microsoft.Azure.Functions.Worker.Sdk 2.1.0.
  • Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore 2.1.1.
  • An HTTP-triggered function registered as Pr22346Functions.ProbeFunction.Run.
  • An AppHost using the real AddAzureFunctionsProject integration, plus an ordinary ASP.NET Core project as a control.
  • Local Azurite containers for Functions host storage; no Azure deployment was performed.

All Aspire references came from the exact PR package hive. Fresh-app external restores used https://packagefeedproxy.microsoft.io/nuget/v3/index.json, configured only in the temporary workspace's Directory.Build.props. No repository NuGet configuration or package manifests were edited.

Visual Studio Functions tooling

The 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:

There is no Functions runtime available that matches the version specified in the project.

The selected cache was release 4.40.0, containing Core Tools 4.0.5198 and no net10-isolated variant. Through Visual Studio's normal Options > Azure Functions > Check for updates > Download & Install UI, the toolset was updated to release 4.138.0, Core Tools 4.16.1, including net10-isolated. The actual debugging scenario then passed. This prerequisite failure was not counted as a PR regression.

The updated per-user Visual Studio Functions toolset was retained. No certificate trust stores were modified.

Repository SDK bootstrap

The required initial restore was attempted:

.\restore.cmd /p:Projects=tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj /p:SkipNativeBuild=true

It failed while extracting the downloaded SDK. The machine already had the exact pinned SDK, 11.0.100. Source tests subsequently passed using that installed SDK with explicit DotNetTool and DotNetRoot MSBuild properties. The initial failure and successful commands are retained in the evidence.

Test scenarios executed

1. Debug-support and DCP source regression tests

Coverage: 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: logs\hosting-tests-installed-sdk.log.

2. Affected .NET project source regression tests

Coverage: 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: logs\dotnet-project-tests.log.

3. Real Visual Studio F5 and an actual Azure Function breakpoint

Coverage: 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 functions.metadata, an ordinary API project, and the AppHost.

The real IDE's Debug.Start command, equivalent to F5, was invoked through DTE. Visual Studio itself supplied:

{
  "supported_launch_configurations": ["project", "browser"]
}

The AppHost recorded declared azure-functions support, hasIdeLaunch: true, and effective project support. The declared resource annotation remained unchanged.

An HTTP request hit the source breakpoint in the real worker:

Observation Value
Visual Studio debugger mode Break mode, 2
Current function Pr22346Functions.ProbeFunction.Run
Source location FunctionsWorker\ProbeFunction.cs:14
Worker process ID 31364
Evaluated Debugger.IsAttached true
Evaluated request path /api/probe

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: vs-f5-breakpoint.png, vs-f5-breakpoint-state.json, vs-f5-http.json, vs-f5-hosting-provenance.json.

4. Real Visual Studio fixed-port HTTPS with AppHost arguments

Coverage: profile arguments must survive a non-empty compatibility invocation.

Result: passed for HTTPS functionality and debugger attachment.

The profile specified --port 7083 --useHttps; the AppHost separately supplied --verbose.

The recorded effective arguments were exactly:

--port 7083 --useHttps --verbose

https://localhost:7083/api/probe returned the expected function marker from worker PID 78684, with debuggerAttached: true. That worker appeared in Visual Studio's debugged-process list. The ordinary API control also responded with its debugger attached.

Evidence: VsFunctionsHttpsFixed-result.json, VsFunctionsHttpsFixed-running.png, logs\vs-https-fixed-functional.log.

5. Real Visual Studio dynamically allocated HTTPS port

Coverage: injected port arguments must not replace the profile's HTTPS/verbose arguments.

Result: passed for HTTPS functionality and debugger attachment.

The profile specified --useHttps --verbose without a port. The recorded effective arguments were:

--useHttps --verbose --port 15591

The allocated public endpoint was https://localhost:15585. An actual function request succeeded from worker PID 67892 with debuggerAttached: true; Visual Studio listed that worker as debugged. The ordinary API control also passed.

Evidence: VsFunctionsHttpsDynamic-result.json, VsFunctionsHttpsDynamic-running.png, logs\vs-https-dynamic-test.log.

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 curl --insecure; certificate-chain trust is therefore not a passed assertion. No machine certificate enrollment or trust-store change was performed.

6. Real Visual Studio Ctrl+F5

Coverage: native IDE launch without debugger attachment.

Result: passed.

A separate fresh solution was started through the real IDE's Debug.StartWithoutDebugging command, equivalent to Ctrl+F5. Visual Studio advertised only project; the AppHost still selected the effective native project launch.

The Functions endpoint on port 7085 returned the expected marker from worker PID 26080 with debuggerAttached: false. The ordinary API also returned false. DTE reported design mode, 1, and an empty debugged-process list. The app stopped cleanly.

Evidence: VsFunctionsNoDebug-result.json, VsFunctionsNoDebug-running.png, logs\vs-no-debug-test.log.

7. CLI-managed Functions fallback, ordinary API, and restart

Coverage: 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

--no-build followed a successful build in this session with no intervening source changes.

The AppHost recorded no active debug session and hasIdeLaunch: false. The Functions and ordinary API endpoints returned their expected JSON with debuggerAttached: false. Restart changed the worker PID from 89512 to 27016, and the function responded successfully afterward. Recorded processes exited after shutdown.

Evidence: cli-functions-http.json, cli-api-http.json, cli-hosting-provenance.json, cli-resource-summary.json, cli-functions-restart-http.log.

8. Invalid certificate arguments under real Visual Studio

Coverage: visible startup error rather than a false-running function.

Result: expected stopped/error behavior observed, with a diagnostic limitation.

The profile supplied:

--port 7089 --useHttps --cert missing-pr22346.pfx --password invalid-test-password

The password is a dummy test value, not a credential. Supplying it ensures the explicit certificate path is used.

Core Tools logged:

Error occurred during a cryptographic operation.
Press any key to continue....

The Functions resource stopped in Finished, exposed no endpoint, and an HTTPS request returned no HTTP response: curl exit 7, HTTP status 000. The ordinary API remained Running.

Diagnostic limitation: the native IDE path did not expose a non-zero process exit code here, and the resource was not labeled FailedToStart. This test confirms the visible console error, stopped resource, and unavailable endpoint; it does not prove correct failure exit-code classification. No baseline comparison was performed to attribute that limitation to this PR.

Evidence: vs-invalid-functions.log, vs-invalid-resource-summary.json, vs-invalid-endpoint.json, vs-invalid-arguments.png.

Summary

Scenario Outcome
Debug-support/DCP source regression tests 372 passed, 1 skipped
.NET project/build-coordinator source tests 220 passed, 7 skipped
Actual Functions source breakpoint in real Visual Studio Passed
Fixed HTTPS port plus profile/AppHost arguments Passed; certificate-chain trust excluded
Dynamic HTTPS port plus preserved profile arguments Passed; certificate-chain trust excluded
Real Visual Studio Ctrl+F5 Passed
CLI fallback, ordinary API, restart, and shutdown Passed
Invalid explicit certificate arguments Stopped/error observed; exit classification not verified

CI status and unvalidated scope

At 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 cleanup

Screenshots, structured results, exact fixture source, automation scripts, and selected logs are preserved with this report in the Copilot session artifacts. The primary evidence is vs-f5-breakpoint.png and vs-f5-breakpoint-state.json; the former shows the actual Visual Studio source breakpoint.

Cleanup was verified at 13:17:15 PST:

  • All recorded test processes exited; no test AppHost or test Visual Studio instance remained.
  • No running Docker containers remained.
  • The explicitly scoped temporary test workspace, downloaded test CLI/packages, and isolated Core Tools copy were removed.
  • The repository was clean on the original session branch.
  • The normal per-user Visual Studio Functions toolset update was retained.

Evidence: cleanup-summary.json, ci-status-at-completion.json.

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 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

Review effort: Max

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Azure Functions projects can lose IDE debugging because the compatibility launch is incorrectly rejected when DEBUG_SESSION_INFO omits a capability list.

1 open issue

Review effort: Max

@github-actions

Copy link
Copy Markdown
Contributor

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]>
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

52 / 101 PR test projects · 4 PR jobs, from 11 changed files.

Selected PR test projects (52 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Hosting.Analyzers.Tests, Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Provisioning.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Browsers.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests, Aspire.Hosting.DevTunnels.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.EntityFrameworkCore.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Garnet.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.Java.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Kafka.Tests, Aspire.Hosting.Keycloak.Tests, Aspire.Hosting.Kubernetes.Tests, Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests, Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.Nats.Tests, Aspire.Hosting.OpenAI.Tests, Aspire.Hosting.Oracle.Tests, Aspire.Hosting.Orleans.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Qdrant.Tests, Aspire.Hosting.RabbitMQ.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests, Aspire.Hosting.Seq.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Hosting.Valkey.Tests, Aspire.Hosting.Yarp.Tests, Aspire.Playground.Tests, Aspire.Templates.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 46 of the 52 selected test projects come from a single change — src/Aspire.Hosting/ApplicationModel/DebugSupportExtensions.cs.

🔧 src/Aspire.Hosting/ApplicationModel/DebugSupportExtensions.cs (changed source)
→ 46 via the project graph

show 46

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.EntraId.Tests (2 hops), Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Provisioning.Tests (3 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Browsers.Tests (2 hops), Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.EntityFrameworkCore.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Garnet.Tests (2 hops), Aspire.Hosting.Go.Tests (2 hops), Aspire.Hosting.Java.Tests (2 hops), Aspire.Hosting.JavaScript.Tests (2 hops), Aspire.Hosting.Kafka.Tests (2 hops), Aspire.Hosting.Keycloak.Tests (2 hops), Aspire.Hosting.Kubernetes.Tests (2 hops), Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests (2 hops), Aspire.Hosting.MongoDB.Tests (2 hops), Aspire.Hosting.MySql.Tests (2 hops), Aspire.Hosting.Nats.Tests (2 hops), Aspire.Hosting.OpenAI.Tests (2 hops), Aspire.Hosting.Oracle.Tests (2 hops), Aspire.Hosting.Orleans.Tests (2 hops), Aspire.Hosting.PostgreSQL.Tests (2 hops), Aspire.Hosting.Python.Tests (2 hops), Aspire.Hosting.Qdrant.Tests (2 hops), Aspire.Hosting.RabbitMQ.Tests (2 hops), Aspire.Hosting.Redis.Tests (2 hops), Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests (2 hops), Aspire.Hosting.Seq.Tests (2 hops), Aspire.Hosting.SqlServer.Tests (2 hops), Aspire.Hosting.Testing.Tests (2 hops), Aspire.Hosting.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops), Aspire.Playground.Tests

🧪 tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.Tests
→ 3 via the project graph: Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Radius.Tests

📦 affected project Aspire.Hosting.Dotnet
→ 2 tests: Aspire.Cli.EndToEnd.Tests, Aspire.Templates.Tests

📦 affected project Aspire.Hosting
→ 1 test: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

🧪 tests/Aspire.Hosting.Tests/Dcp/ExecutableLaunchPlanTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

🧪 tests/Aspire.Hosting.Tests/Dcp/ResourceSnapshotBuilderTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

🧪 tests/Aspire.Hosting.Tests/DebugSupportExtensionsTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Hosting.Redis
extension-e2e • src/Aspire.Hosting/ApplicationModel/DebugSupportExtensions.cs, src/Aspire.Hosting/ApplicationModel/ExecutableLaunchRecipe.cs, src/Aspire.Hosting/Dcp/ExecutableLaunchPolicy.cs, src/Aspire.Hosting/Dcp/ResourceSnapshotBuilder.cs, src/Aspire.Hosting/ResourceBuilderExtensions.cs, src/Aspire.Hosting/SupportsDebuggingAnnotation.cs
• affected project Aspire.Hosting
polyglot • affected project Aspire.Hosting
• affected project Aspire.Hosting.Azure.Provisioning
typescript-api-compat affected project Aspire.Hosting

Selection computed for commit add2204.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 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

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@karolz-ms

Copy link
Copy Markdown
Contributor Author

PR Testing Report

PR Information

  • PR: microsoft/aspire#22346
  • Title: Fix Visual Studio debugging for Azure Functions projects
  • Head commit: add2204df9dea57664df72bd49791ff16e7fe460
  • Tested: November 17, 2026, Pacific time (November 18 UTC)
  • Execution: Local Windows desktop, including the actual Visual Studio IDE.

Artifact Version Verification

  • Expected head: add2204df9dea57664df72bd49791ff16e7fe460
  • Installed native CLI: 17.1.0-pr.22346.gadd2204d -- matches the PR head.
  • Hosting packages: 17.1.0-pr.22346.gadd2204d.
  • Artifact run: 44215697282, whose head_sha matches the PR head.
  • Package repository commit: 8f3f1e5fa1a3175e9fcdc7f2dea40a25dcdd7390. This is GitHub's merge commit, verified to have the exact PR head as its second parent, not an unrelated or stale package.
  • Final IDE runs: Both fixtures explicitly selected the installed PR CLI through AspireCliPath. MSBuild resolved DCP and Dashboard under that isolated PR installation rather than the machine's stable installation.
  • Status: Verified. The PR head was checked again after testing and had not changed.

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

Component Version / configuration
IDE Visual Studio Enterprise 2026 Insiders, 18.13.12412.241
Actual IDE executable C:\Program Files\Microsoft Visual Studio\18\Insiders\Common7\IDE\devenv.exe
Source build SDK .NET 11.0.100
AppHost, Function, and ASP.NET targets net10.0
Functions worker Microsoft.Azure.Functions.Worker 2.52.0
Functions SDK Microsoft.Azure.Functions.Worker.Sdk 2.1.0
Functions HTTP integration Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore 2.1.1
VS Functions tools Releases\4.138.0\cli_x64; func --version reported 4.16.1
Package restore PR artifact folder and https://packagefeedproxy.microsoft.io/nuget/v3/index.json

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 AddAzureFunctionsProject<TProject>, matching the affected Visual Studio workflow. The PR SDK emits the expected ASPIRE012 legacy-SDK migration warning; the fixture was not converted to a different resource model merely to avoid that warning.

Changes Analyzed

File Changed behavior
src/Aspire.Hosting/ApplicationModel/DebugSupportExtensions.cs Centralized effective debug-support decisions and native-project compatibility fallback
src/Aspire.Hosting/ApplicationModel/ExecutableLaunchRecipe.cs Preserving launch-profile arguments and launch-tool argument ownership
src/Aspire.Hosting/Dcp/ExecutableLaunchPolicy.cs Selecting IDE versus process execution
src/Aspire.Hosting/Dcp/ResourceSnapshotBuilder.cs Fail-closed IDE launch-command metadata
src/Aspire.Hosting/ResourceBuilderExtensions.cs Launch-tool ownership documentation
src/Aspire.Hosting/SupportsDebuggingAnnotation.cs Compatibility annotation behavior and documentation
tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj Dashboard build-reference framework isolation
tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs Launch routing and argument regression coverage
tests/Aspire.Hosting.Tests/Dcp/ExecutableLaunchPlanTests.cs Compatibility launch-tool argument coverage
tests/Aspire.Hosting.Tests/Dcp/ResourceSnapshotBuilderTests.cs IDE metadata regression coverage
tests/Aspire.Hosting.Tests/DebugSupportExtensionsTests.cs Effective debug-support and extension-contract coverage

Categories: Hosting and tests. No CLI implementation, Dashboard UI, template, client integration, VS Code extension, or CI workflow changes.

Test Scenarios Executed

1. Verified native dogfood installation and fresh project creation

Coverage: Artifact identity and CLI/template smoke test.
Status: Passed.

Installed using the PR's dogfood PowerShell script with -InstallPath, -SkipExtension, and -SkipPath. The exact installed executable reported 17.1.0-pr.22346.gadd2204d.

Created a separate DogfoodSmoke project using:

& $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-interactive

Here $cliPath was the isolated install's dogfood\pr-22346\bin\aspire.exe; $hivePath was its hives\pr-22346\packages directory. No installed machine-wide CLI was used for this check.

Evidence: dogfood-install.log, dogfood-version.txt, dogfood-new.log, tested-pr.json, package-merge-provenance.json, hosting-package.nuspec, pr-runtime-bundle.json.

2. Actual Azure Functions debugging in real Visual Studio

Coverage: User-visible end-to-end happy path.
Status: Passed.

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 devenv.exe, opened the solution visibly, selected the AppHost as startup project, built through Visual Studio, created a breakpoint in ProbeFunction.Run at line 10, and invoked Visual Studio's debugger Go command (the F5 operation).

An HTTP request to http://localhost:7183/api/probe hit that breakpoint. Visual Studio's debugger reported:

BreakReason: dbgEventReasonBreakpoint
DebuggerMode: dbgBreakMode
CurrentFunction: ProbeFunction.Run
CurrentLine: 10

The debugged-process inventory contained both the AppHost and the actual isolated Functions worker. The Debug output explicitly confirmed:

'dotnet.exe' (CoreCLR: clrhost): Loaded '...\FunctionsVisualStudio.Functions.dll'. Symbols loaded.

Continuing execution completed the request with:

200 PR22346_REAL_FUNCTION_BREAKPOINT

No manual attach, capability override, or forced replacement of the Functions launch type was used.

Evidence: vs-functions-pr-bundle.json, vs-functions-pr-bundle.json.cycle-1.png, vs-functions-pr-bundle.json.debug-cycle-1.Debug.txt.

3. Functions profile arguments, AppHost arguments, and stop/restart

Coverage: Argument boundary and lifecycle recovery.
Status: Passed.

The Function launch profile specified --port 7183, while the AppHost added .WithArgs("--verbose"). The real process inventory captured the IDE-owned Functions host command:

dotnet.exe ...\func.dll host start --port 7183 --verbose --pause-on-error --dotnet-isolated-debug --enable-json-output --json-output-file ...

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 105120 to 60096; the Function breakpoint hit again, symbols loaded again, and the second request also returned 200 PR22346_REAL_FUNCTION_BREAKPOINT. Both cycles built successfully through Visual Studio.

Evidence: Both cycle entries in vs-functions-pr-bundle.json, both cycle screenshots, and vs-functions-pr-bundle.json.debug-cycle-2.Debug.txt.

4. Ordinary ASP.NET project debugging regression

Coverage: Separate user-visible end-to-end regression scenario.
Status: Passed.

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 Program.cs line 5, and the Debug output confirmed the web assembly's symbols loaded. Continuing returned:

200 PR22346_ORDINARY_PROJECT_BREAKPOINT

Evidence: vs-ordinary-pr-bundle.json, vs-ordinary-pr-bundle.json.cycle-1.png, vs-ordinary-pr-bundle.json.debug-cycle-1.Debug.txt.

5. Focused source regression tests, including negative/boundary coverage

Coverage: Automated source tests at the exact PR head.
Status: Passed -- 451 passed, 1 Linux-only test skipped, 0 failed.

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:

Negative / boundary case Expected behavior covered
Aspire extension sessions omit azure-functions Their capability list remains authoritative; use process execution, not native-project compatibility
Native IDE omits project Do not select an unsupported project launch
Other unsupported custom launch types Do not apply the Functions-specific fallback
Forced-process, persistent resources, and project launch overrides Preserve process ownership
Fixed and dynamically allocated HTTPS ports Preserve relevant launch-profile arguments
Retained launch-tool argument prefixes Do not let synthesized compatibility metadata claim producer ownership
IDE snapshot with a custom launch type Do not incorrectly report a native project/dotnet launch command

The skipped test was PlainExecutableCertificateDirectoriesPath_IncludesExistingWellKnownDirectoriesForAppendWhenSslCertDirIsUnsetOnLinux, because OpenSSL directory inference is Linux-only.

Evidence: focused-tests.txt preserves the command and result from the tool transcript; it is explicitly labeled as a transcript summary rather than an unedited stdout log.

Summary

Scenario Status
Native PR CLI install, version match, and fresh project creation Passed
Actual Azure Function source breakpoint in real Visual Studio Passed
Profile/AppHost argument retention and F5 stop/restart Passed
Ordinary ASP.NET source breakpoint in real Visual Studio Passed
Focused launch-policy, arguments, debug support, and snapshot tests 451 passed, 1 platform skip

Overall Result

PR 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

  • Tested the installed 18.13 Insiders build, not the reporter's older 18.12 release.
  • Real VS Code execution was not tested; extension-capability routing was covered by the focused source tests.
  • Dashboard UI was not independently inspected. This PR does not change Dashboard UI.
  • Initial short-timeout harness requests could expire while intentionally paused at a breakpoint. Final PR-bundle runs used a longer request timeout, and both Functions cycles and the ordinary-project cycle completed with HTTP 200 after Continue.
  • Visual Studio displayed internal feature-error notifications, and the Functions debugger output included first-chance Azure request exceptions. Neither prevented the verified source breakpoints or successful HTTP completion.
  • Earlier diagnostic attempts could not read some unrelated VS Output panes. Final runs captured only Build and Debug output and completed without that capture error.
  • This is targeted PR testing, not a claim that every repository test or every PR CI job passed.

Artifacts and Cleanup

The report, debugger screenshots, JSON process inventories, debugger output, CLI logs, version/provenance records, and pr-22346-fixture-sources.zip are preserved together in this session's artifact directory:

C:\Users\karolz\.copilot\session-state\e9fd28a4-0346-43fa-81ee-d99db545eb96\files

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.

@karolz-ms
Karol Zadora-Przylecki (karolz-ms) merged commit d6892bf into main Nov 18, 2026
709 of 712 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.1 milestone Nov 18, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Branch: proven false positive on experimental_attribute_added, which corresponds to the allowlist category bug_fix_restores_documented_behavior.

  • Triggered signal: experimental_attribute_added. Its evidence is [Experimental("ASPIREEXTENSION001", ...)] in src/Aspire.Hosting/ApplicationModel/DebugSupportExtensions.cs.
  • In the patch, that attribute line is unchanged context (hunk @@ -15,30 +15,63 @@). The PR did not add it, and the SupportsDebugging API surface is unchanged.
  • The PR is a bug fix: Visual Studio debugging of Azure Functions projects now uses the project compatibility launch when the IDE advertises project but not azure-functions, and the session is not an Aspire extension session.
  • No new public API, flags, options or strings were added. ASPIREEXTENSION001 is already an experimental, extension-internal API that the existing docs do not describe.
  • No docs update is needed.

@karolz-ms

Copy link
Copy Markdown
Contributor Author

/backport to release/17.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/17.0 (link to workflow run)

Jose Perez Rodriguez (joperezr) pushed a commit that referenced this pull request Nov 23, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS2026 18.12.0 (Nov update) cannot hit breakpoint in Azure Functions project; symbol not loaded with Aspire 13.6.5 (yet again)

3 participants