Skip to content

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

Draft
rolfbjarne wants to merge 3 commits 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 3 commits 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

…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 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

Copy link
Copy Markdown
Collaborator

🔥 [PR Build #68d6c60] Build failed (Build macOS tests) 🔥

Build failed for the job 'Build macOS tests' (with job status 'Failed')

Pipeline on Agent
Hash: 68d6c60813d91f782f481abdfeb622331617f065 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #68d6c60] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

3 tests crashed, 2 tests failed, 191 tests passed.

Failures

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.DotNetProjectTest.Run(MacOSX,False): Xamarin debug environment variables should not leak to app
      Assert.That(envContents, Does.Contain ("_XAMARIN_DEBUG"))
      Expec...
    • Xamarin.Tests.DotNetProjectTest.Run(MacOSX,True): Xamarin debug environment variables should not leak to app
      Assert.That(envContents, Does.Contain ("_XAMARIN_DEBUG"))
      Expec...

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

1 tests failed, 17 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Release (link all): Failed

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests

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

Html Report (VSDrops) Download

❌ Tests on macOS Sequoia (15) tests

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

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

🔥 Failed catastrophically on VSTS: test results - mac_tahoe (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 (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): 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 (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

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 68d6c60813d91f782f481abdfeb622331617f065 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [PR Build #5dd6c8b] Build failed (Detect API changes) 🔥

Build failed for the job 'Detect API changes' (with job status 'Failed')

Pipeline on Agent
Hash: 5dd6c8b1197ed2dc4a446e3a076bbf39410fa251 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 Unable to find the contents for the comment: D:\a\1\s\change-detection\results\gh-comment.md does not exist :fire

Pipeline on Agent
Hash: 5dd6c8b1197ed2dc4a446e3a076bbf39410fa251 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [PR Build #5dd6c8b] Build failed (Build packages) 🔥

Build failed for the job 'Build packages' (with job status 'Failed')

Pipeline on Agent
Hash: 5dd6c8b1197ed2dc4a446e3a076bbf39410fa251 [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