Skip to content

[runtime] Initialize the output directory for crash reports before loading CoreCLR. Fixes #25820#25823

Draft
rolfbjarne wants to merge 1 commit into
net11.0from
dev/rolf/coreclr-crash-report-output-dir
Draft

[runtime] Initialize the output directory for crash reports before loading CoreCLR. Fixes #25820#25823
rolfbjarne wants to merge 1 commit into
net11.0from
dev/rolf/coreclr-crash-report-output-dir

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

CoreCLR can write crash reports to a configurable directory via the DOTNET_CrashReportRootPath environment variable. This PR sets that variable before coreclr_initialize is called, pointing it at <NSCachesDirectory> -- a writable location that is not backed up by iCloud.

A new xamarin_is_sandboxed() helper detects whether the current process is sandboxed by querying the com.apple.security.app-sandbox entitlement via SecTaskCopyValueForEntitlement. On iOS/tvOS it returns true unconditionally. For non-sandboxed desktop apps (macOS, Mac Catalyst), the bundle identifier is appended to the caches path so each app gets its own directory.

Ref: dotnet/runtime#128738

Fixes #25820

🤖 Pull request created by Copilot

@rolfbjarne rolfbjarne changed the base branch from main to net11.0 June 25, 2026 16:43
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

…ading CoreCLR.

Set DOTNET_CrashReportRootPath to <NSCachesDirectory> before calling
coreclr_initialize, so that CoreCLR knows where to write crash reports.

A new xamarin_is_sandboxed() function detects whether the app is sandboxed:
- On iOS/tvOS it returns true unconditionally (always sandboxed).
- On macOS/Mac Catalyst it queries the com.apple.security.app-sandbox
  entitlement using SecTaskCopyValueForEntitlement.

For non-sandboxed apps, the bundle identifier is appended to the caches path
to keep the directory app-specific (sandboxed apps already get an app-specific
caches directory from the OS).

The environment variable is not overwritten if already set.

Fixes #25820

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rolfbjarne rolfbjarne force-pushed the dev/rolf/coreclr-crash-report-output-dir branch from 5dd6c8b to d27d08c Compare July 3, 2026 15:00
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #d27d08c] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: d27d08cb047ce601be3b91822c576502be2555b6 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #d27d08c] Build passed (Build packages) ✅

Pipeline on Agent
Hash: d27d08cb047ce601be3b91822c576502be2555b6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [CI Build #d9ea4b0] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: d9ea4b01804af0ebbe55736586b4d9a137ace421 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: d27d08cb047ce601be3b91822c576502be2555b6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [CI Build #d9ea4b0] Prepare .NET Release succeeded ✅

📦 Published NuGet packages (32 packages)

iOS

  • Microsoft.iOS.Ref.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Runtime.ios-arm64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Runtime.ios.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Runtime.iossimulator-arm64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Runtime.iossimulator-x64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Sdk.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Templates.26.5.11820-net11-p7.nupkg
  • Microsoft.iOS.Windows.Sdk.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.NET.Sdk.iOS.Manifest-11.0.100-preview.7.26.5.11820-net11-p7.nupkg

MacCatalyst

  • Microsoft.MacCatalyst.Ref.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst-arm64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst-x64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.MacCatalyst.Sdk.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.MacCatalyst.Templates.26.5.11820-net11-p7.nupkg
  • Microsoft.NET.Sdk.MacCatalyst.Manifest-11.0.100-preview.7.26.5.11820-net11-p7.nupkg

macOS

  • Microsoft.macOS.Ref.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.macOS.Runtime.osx-arm64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.macOS.Runtime.osx-x64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.macOS.Runtime.osx.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.macOS.Sdk.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.macOS.Templates.26.5.11820-net11-p7.nupkg
  • Microsoft.NET.Sdk.macOS.Manifest-11.0.100-preview.7.26.5.11820-net11-p7.nupkg

tvOS

  • Microsoft.NET.Sdk.tvOS.Manifest-11.0.100-preview.7.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Ref.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Runtime.tvos-arm64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Runtime.tvos.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Runtime.tvossimulator-arm64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Runtime.tvossimulator-x64.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Sdk.net11.0_26.5.26.5.11820-net11-p7.nupkg
  • Microsoft.tvOS.Templates.26.5.11820-net11-p7.nupkg

Other

  • Sharpie.Bind.Tool.26.6.0.424-net11-p7.nupkg

Pipeline on Agent
Hash: d9ea4b01804af0ebbe55736586b4d9a137ace421 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #d27d08c] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 0 tests failed, 207 tests passed.

Failures

❌ dotnettests tests (iOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_ios (no summary found).

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: d27d08cb047ce601be3b91822c576502be2555b6 [PR build]

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.

Initialize the output directory for crash reports before loading coreclr.

2 participants