Skip to content

[release/11.0] [iOS] Avoid debugger patches in R2R code without dynamic code support - #134139

Merged
steveisok merged 1 commit into
release/11.0from
backport/pr-133577-to-release/11.0
Sep 18, 2026
Merged

steveisok merged 1 commit into
release/11.0from
backport/pr-133577-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #133577 to release/11.0

/cc @matouskozak

Customer Impact

  • Customer reported
  • Found internally

The debugging on iOS physical devices doesn't work because debugger tries to put an internal breakpoint into the R2R images which triggers a code signing crash on iOS. This means that an iOS app cannot start in debug on physical devices. This PR prevents debugger attempts to put a patch into R2R code on platforms that are build with disabled dynamic code compilation. Currently, only iOS/tvOS are configurations which ship under CoreCLR with dynamic code compilation.

Regression

  • Yes
  • No

Testing

This was uncovered by CSI manual testing on physical iOS devices (https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3027937). The fix was verified to work in both VS and VS Code debugger on physical iOS devices.

Risk

Low:
The biggest change (blocking patches on R2R code) is covered by #ifndef FEATURE_DYNAMIC_CODE_COMPILED thus shouldn't affect any other configuration that is supported under debugger. The rest of changes is around propagation of results in case the ActivatePatch false.
Note, this change can cause debugger issues on windows x64 if build without dynamic code compile as mentioned in #133577 (comment) but we don't ship that configuration anywhere currently.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • For .NET 8 and .NET 9: The PR target branch is release/X.0-staging, not release/X.0.
  • For .NET 10+: The PR target branch is release/X.0 (no -staging suffix).

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

…#133577)

## Description

When CoreCLR runs an R2R + interpreter application on a physical iOS
device, `DebuggerThreadStarter` can try to place a software breakpoint
in signed R2R code. Making the page writable removes execute permission,
and iOS does not allow the runtime to restore it. The process is then
terminated with a code-signing invalid-page failure.

This change prevents debugger patch activation in R2R code when
`FEATURE_DYNAMIC_CODE_COMPILED` is disabled. It also:

- propagates patch activation failure instead of reporting success;
- removes or unbinds patches that cannot be activated;
- keeps deferred R2R patches unbound;
- cancels the pending `DebuggerThreadStarter` when interpreter entry
sends the thread-start event directly;

Breakpoints cannot be activated in R2R methods in this configuration. A
direct breakpoint request fails with
`CORDBG_E_UNABLE_TO_SET_BREAKPOINT`.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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.

@steveisok steveisok added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 18, 2026
@ViveliDuCh

Copy link
Copy Markdown
Member

Hi,

the code complete date for RC2 is Monday 21st September. Make sure to merge this PR on that date at the latest, or it won't make it into that release.

As a reminder, if this is a product change, you also need Tactics approval before merging this PR (test-only or infra-only changes don't require Tactics approval).

@steveisok
steveisok merged commit df7efa1 into release/11.0 Sep 18, 2026
136 of 144 checks passed
@steveisok
steveisok deleted the backport/pr-133577-to-release/11.0 branch September 18, 2026 11:44
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants