Skip to content

Fix breakpoint and stepping behavior for runtime async variants - #137764

Merged
tommcdon merged 2 commits into
dotnet:mainfrom
tommcdon:dev/tommcdon/fix-runtime-async-debugger-137559
Nov 18, 2026
Merged

tommcdon merged 2 commits into
dotnet:mainfrom
tommcdon:dev/tommcdon/fix-runtime-async-debugger-137559

Conversation

@tommcdon

Copy link
Copy Markdown
Member

Summary

  • Bind breakpoints to async variants that execute user code, including variants compiled before debugger attachment.
  • Preserve stepping through synthetic async thunks without skipping user-code async variants.

Fixes #137559

tommcdon and others added 2 commits November 17, 2026 12:51
Allow debugger breakpoints and stepping to reach IL-backed async variants
while continuing to skip synthetic async thunks.

Related to dotnet#137559

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 54e87508-5323-495e-bc5b-d7f7b14605f9
Create debugger JIT information for already-compiled async variants when binding breakpoints after attachment.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 54e87508-5323-495e-bc5b-d7f7b14605f9
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@tommcdon

Copy link
Copy Markdown
Member Author

/ba-g Only failures are iOS device Helix work items (iOS.CoreCLR.Interpreter.Test, iOS.Device.ExportManagedSymbols.Test, iOS.Device.ParallelForEachAsync.Test, System.Runtime.Tests on osx.15.amd64.iphone.open) failing with XHarness exit 78 PACKAGE_INSTALLATION_FAILURE (devicectl: Can't assign requested address) on four different machines; the app never installed. The same iOS device failures occur on unrelated PR #137747. This PR only changes CoreCLR debugger code.

@tommcdon
tommcdon merged commit 627f5af into dotnet:main Nov 18, 2026
101 of 103 checks passed
@tommcdon

Copy link
Copy Markdown
Member Author

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

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

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
steveisok pushed a commit that referenced this pull request Nov 20, 2026
… variants (#137874)

Backport of #137764 to release/11.0

Fixes #137559

/cc @tommcdon

## Customer Impact

- [x] Customer reported
- [ ] Found internally

Reported in #137559. In .NET 11, a breakpoint in a method that returns
`Task`/`ValueTask` (and is not itself `async`) is not hit when the
method is awaited by a runtime-async caller, even though the breakpoint
is reported as bound and the code runs. Because the .NET 11 BCL is
compiled with runtime async, this affects ordinary apps that never opt
into the feature: for example, a breakpoint in a `Stream.ReadAsync`
override awaited by `StreamReader.ReadToEndAsync` is never hit. Stepping
into and out of such methods through the runtime-async thunks is also
affected. The same scenario works on .NET 10.

The fix binds breakpoints to async variants that are compiled from the
method's own IL (including variants jitted before the debugger
attached), and keeps stepping working through synthetic async thunks
without skipping user-code async variants.

## Regression

- [x] Yes
- [ ] No

Regression from .NET 10, introduced when the runtime began compiling
async variants of Task-returning methods from the method's own IL
(#128384). The debugger excluded every async thunk `MethodDesc` from
breakpoint binding, which now also excludes those IL-backed variants.

## Testing

- Reproduced the issue scenario on .NET 11 and on main, and verified
with the fix that breakpoints in Task/ValueTask-returning methods
awaited by runtime-async callers are hit, that step-in and step-out work
through the async thunks, and that breakpoints bind when the debugger
attaches after the variant was already jitted.
- Ran the managed debugger async and stepping test suite against main
with and without the fix; the fix introduced no new failures.
- Full CI on #137764 in main.
- This backport is a clean cherry-pick of the main commit (same three
files).

The scenario was missed because existing debugger tests did not cover
breakpoints in non-async Task-returning methods awaited through
runtime-async callers.

## Risk

Low. The change is limited to the debugger's breakpoint binding and
stepping logic (`controller.cpp`, `functioninfo.cpp`) and debugger stub
tracing (`stubmgr.cpp`), which only run with a managed debugger
attached. It narrows an existing exclusion so that it skips only thunks
that are not compiled from user IL. No code generation or runtime
behavior changes when no debugger is attached.

Co-authored-by: Tom McDonald <[email protected]>
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 54e87508-5323-495e-bc5b-d7f7b14605f9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime async: breakpoint in Task-returning method not hit when awaited by runtime-async method

2 participants