Skip to content

[clr-ios] Include macOS DAC/DBI in iOS CoreCLR runtime pack for remote debugging#126315

Closed
kotlarmilos wants to merge 1 commit intodotnet:mainfrom
kotlarmilos:dev/kotlarmilos/ios-debugger-assets
Closed

[clr-ios] Include macOS DAC/DBI in iOS CoreCLR runtime pack for remote debugging#126315
kotlarmilos wants to merge 1 commit intodotnet:mainfrom
kotlarmilos:dev/kotlarmilos/ios-debugger-assets

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

@kotlarmilos kotlarmilos commented Mar 30, 2026

Description

When debugging iOS CoreCLR apps remotely, debugger runs on the macOS host and needs macOS-platform DAC/DBI (libmscordaccore.dylib, libmscordbi.dylib) to inspect the target process. The iOS runtime pack only contains iOS-platform DAC/DBI, which vsdbg cannot dlopen. This change adds an osxdac build subset (following the linuxdac/alpinedac pattern) that builds the macOS CoreCLR debug component during Apple mobile builds, and packages the resulting macOS DAC/DBI under tools/osx-{arch}/ in the iOS CoreCLR runtime pack.

Related macios PR: dotnet/macios#25041

Fixes #125974

When debugging iOS CoreCLR apps remotely, vsdbg runs on the macOS host and
needs macOS-platform DAC/DBI (libmscordaccore.dylib, libmscordbi.dylib) to
inspect the target process. The iOS runtime pack only contains iOS-platform
DAC/DBI, which vsdbg cannot dlopen.

This change adds an osxdac build subset (following the linuxdac/alpinedac
pattern) that builds the macOS CoreCLR debug component during Apple mobile
builds, and packages the resulting macOS DAC/DBI under tools/osx-{arch}/
in the iOS CoreCLR runtime pack. The macios SDK will extract these host-side
components to a debugger assets directory where vsdbg can load them.

Changes:
- eng/Subsets.props: Add OsxDac subset definition and include it in Apple
  mobile default subsets (before packs, so artifacts exist at pack time)
- eng/liveBuilds.targets: Add CoreCLRHostDebugComponentDir property and
  CoreCLRHostDebugFiles item group to pick up osx DAC/DBI artifacts
- Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj: Pack host debug files
  under tools/osx-{arch}

Fixes dotnet#125974

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 30, 2026 13:52
@kotlarmilos kotlarmilos changed the title Include macOS DAC/DBI in iOS CoreCLR runtime pack for remote debugging [clr-ios] Include macOS DAC/DBI in iOS CoreCLR runtime pack for remote debugging Mar 30, 2026
@kotlarmilos kotlarmilos added the os-ios Apple iOS label Mar 30, 2026
@kotlarmilos kotlarmilos added this to the 11.0.0 milestone Mar 30, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger
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

Adds host (macOS) DAC/DBI build + packaging to the iOS/tvOS CoreCLR runtime pack so remote debugging on Apple mobile targets can load the correct host-side diagnostic libraries.

Changes:

  • Introduces an osxdac build subset for Apple mobile builds that builds the macOS CoreCLR debug component (DAC/DBI).
  • Plumbs the macOS DAC/DBI outputs into the live-build item graph (CoreCLRHostDebugFiles) for packing.
  • Packs the host macOS DAC/DBI into the Apple mobile CoreCLR runtime pack under tools/osx-{arch}/.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
eng/Subsets.props Adds osxdac subset and wires it into Apple mobile default subsets and AllSubsets on macOS.
eng/liveBuilds.targets Adds properties/items to locate macOS DAC/DBI outputs and expose them as CoreCLRHostDebugFiles.
src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj Packs CoreCLRHostDebugFiles into the runtime pack under tools/osx-$(BuildArchitecture) with PackOnly=true.

Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir>
<!-- For Apple mobile the host debugger needs host-platform DAC/DBI to inspect the remote process. -->
<CoreCLRHostDebugComponentDir
Condition="'$(TargetsAppleMobile)' == 'true'">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', 'osx.$(BuildArchitecture).$(CoreCLRConfiguration)', 'sharedFramework'))</CoreCLRHostDebugComponentDir>
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

CoreCLRHostDebugComponentDir is hardcoded to $(RepoRoot)/artifacts/bin/... and doesn’t follow the override patterns used above (CoreCLROverridePath/RuntimeArtifactsPath). If a build is using an alternate artifacts location, the host DAC/DBI won’t be found and will be silently omitted from the pack. Consider deriving this path from the same artifacts root used for CoreCLRArtifactsPath (or add/consume a dedicated override property and default it using $(ArtifactsBinDir)).

Suggested change
Condition="'$(TargetsAppleMobile)' == 'true'">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', 'osx.$(BuildArchitecture).$(CoreCLRConfiguration)', 'sharedFramework'))</CoreCLRHostDebugComponentDir>
Condition="'$(CoreCLRHostDebugComponentDir)' == '' and '$(TargetsAppleMobile)' == 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', 'osx.$(BuildArchitecture).$(CoreCLRConfiguration)', 'sharedFramework'))</CoreCLRHostDebugComponentDir>

Copilot uses AI. Check for mistakes.
Comment on lines +146 to +148
<CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')"
Include="$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)" IsNative="true" />
<CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')"
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The item include is guarded by Exists('$(CoreCLRHostDebugComponentDir)'), but the items reference specific files. If the directory exists without one of the expected files (e.g., leftover artifacts from a different build), the pack build will fail when it tries to include a non-existent file. Guard each Include with an Exists('') check (or switch to a glob and filter) to ensure only existing files are added, and optionally emit an error when TargetsAppleMobile is true but the expected DAC/DBI outputs are missing.

Suggested change
<CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')"
Include="$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)" IsNative="true" />
<CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')"
<CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)')"
Include="$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)" IsNative="true" />
<CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordbi$(LibSuffix)')"

Copilot uses AI. Check for mistakes.
@kotlarmilos
Copy link
Copy Markdown
Member Author

After discussion with @thaystg, this isn't needed. The host debugger component should be sufficient

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.

[clr-ios] Copy post-link assemblies and include DAC/DBI libraries for iOS remote debugger

2 participants