Skip to content

Skip CallEntryPoint in debugger single-step to prevent false stop#127156

Merged
tommcdon merged 3 commits intodotnet:mainfrom
tommcdon:dev/tommcdon/fix_step_out_main
Apr 20, 2026
Merged

Skip CallEntryPoint in debugger single-step to prevent false stop#127156
tommcdon merged 3 commits intodotnet:mainfrom
tommcdon:dev/tommcdon/fix_step_out_main

Conversation

@tommcdon
Copy link
Copy Markdown
Member

When stepping next at the last line of Main, the debugger lands in the managed Environment.CallEntryPoint which stops the debuggee in a frame with no source info rather than the process simply exiting.

Extend the existing IsInteropStub check in TriggerSingleStep to also recognize g_pEnvironmentCallEntryPointMethodDesc. When the single-step lands there, disable it and let the process exit naturally, matching the previous behavior when the return landed in native code.

Found with internal VS debugger testing.

When stepping next at the last line of Main, the debugger lands in the managed Environment.CallEntryPoint which stops the debuggee in a frame with no source info rather than the process simply exiting.

Extend the existing IsInteropStub check in TriggerSingleStep to also recognize g_pEnvironmentCallEntryPointMethodDesc. When the single-step lands there, disable it and let the process exit naturally, matching the previous behavior when the return landed in native code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tommcdon tommcdon added this to the 11.0.0 milestone Apr 20, 2026
@tommcdon tommcdon requested review from jkotas and noahfalk April 20, 2026 13:13
@tommcdon tommcdon self-assigned this Apr 20, 2026
Copilot AI review requested due to automatic review settings April 20, 2026 13:13
@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.

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

Adjusts CoreCLR debugger stepping behavior so that stepping off the end of Main doesn’t land in System.Environment.CallEntryPoint (a runtime helper frame without source), and instead behaves like stepping into native code so the process can exit naturally.

Changes:

  • Extends the “ignore interop stub single-step” special-case to also ignore Environment.CallEntryPoint (g_pEnvironmentCallEntryPointMethodDesc) in DebuggerStepper::TriggerSingleStep.
  • Updates logging/commentary to reflect the expanded behavior and rationale.

Copy link
Copy Markdown
Member

@am11 am11 left a comment

Choose a reason for hiding this comment

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

Thank you! I was relying on public test infra. :)

Comment thread src/coreclr/debug/ee/controller.cpp Outdated
Copilot AI review requested due to automatic review settings April 20, 2026 14:25
Comment thread src/coreclr/debug/ee/controller.cpp Outdated
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

5 participants