Skip to content

[net11.0] Keep R2R debug info in Debug for CoreCLR Apple mobile#25598

Closed
kotlarmilos wants to merge 1 commit into
dotnet:net11.0from
kotlarmilos:dev/kotlarmilos/r2r-keep-debug-info-in-debug-net11.0
Closed

[net11.0] Keep R2R debug info in Debug for CoreCLR Apple mobile#25598
kotlarmilos wants to merge 1 commit into
dotnet:net11.0from
kotlarmilos:dev/kotlarmilos/r2r-keep-debug-info-in-debug-net11.0

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

The .NET SDK defaults PublishReadyToRunStripDebugInfo=true for ios/tvos/iossimulator/tvossimulator/maccatalyst RIDs, so crossgen2 is invoked with --strip-debug-info and the composite R2R image ships without a READYTORUN_SECTION_DEBUG_INFO section. macios additionally defaults PublishReadyToRun=true (composite) for CoreCLR even in Debug, so the user assembly itself is composite-R2R'd with no IL-to-native map.

Under the CoreCLR remote debugger this means DebuggerJitInfo::LazyInitBounds never populates m_sequenceMap, line-level breakpoints cannot bind to the right native offset (only method entry), and DebuggerJitInfo::MapILOffsetToNative dereferences a NULL map entry on the first R2R load that matches an IL primary patch (see dotnet/runtime#128764 for the defensive runtime fix).

Default PublishReadyToRunStripDebugInfo=false for the CoreCLR apple-mobile + Debug combination so the re-composited R2R image keeps debug info and the debugger gets accurate IL-to-native mappings. Release builds are unaffected and still strip.

The .NET SDK defaults PublishReadyToRunStripDebugInfo=true for ios/tvos/
iossimulator/tvossimulator/maccatalyst RIDs, which passes --strip-debug-info
to crossgen2 and drops READYTORUN_SECTION_DEBUG_INFO from the composite
R2R image. macios additionally defaults PublishReadyToRun=true (composite)
for CoreCLR even in Debug, so user code ends up R2R'd with no IL-to-native
map. The result under the CoreCLR remote debugger is that
DebuggerJitInfo::LazyInitBounds cannot populate m_sequenceMap, line-level
breakpoints fail to bind to a native offset, and (without
dotnet/runtime#128764) MapILOffsetToNative crashes on a NULL map entry.

Default PublishReadyToRunStripDebugInfo=false for CoreCLR apple-mobile
Debug builds so the re-composited R2R image keeps debug info and the
debugger gets accurate IL-to-native mappings. Release builds are
unaffected and still strip.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 1, 2026 12:08
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

This PR adjusts the Apple workload MSBuild defaults so CoreCLR Debug builds on Apple mobile platforms keep ReadyToRun (R2R) debug info, improving CoreCLR remote debugging by preserving IL-to-native sequence point mappings in composite R2R images.

Changes:

  • Set PublishReadyToRunStripDebugInfo=false by default for CoreCLR + non-macOS Debug builds when the user hasn’t specified a value.
  • Add an MSBuild comment documenting why stripping debug info breaks/degrades line-level breakpoint binding for R2R methods under the CoreCLR remote debugger.
Show a summary per file
File Description
dotnet/targets/Xamarin.Shared.Sdk.props Defaults PublishReadyToRunStripDebugInfo to false for CoreCLR Debug builds on non-macOS Apple platforms to preserve R2R debug info for better debugging.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@kotlarmilos kotlarmilos closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants