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

…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

Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: b34c3c668927fd612e967e042ae0843926de23d6 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: b34c3c668927fd612e967e042ae0843926de23d6 [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: b34c3c668927fd612e967e042ae0843926de23d6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #b34c3c6] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: b34c3c668927fd612e967e042ae0843926de23d6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #b34c3c6] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 30 tests failed, 198 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

❌ fsharp tests

2 tests failed, 2 tests passed.

Failed tests

  • fsharp/iOS - simulator/Debug: LaunchTimedOut
  • fsharp/tvOS - simulator/Debug: LaunchTimedOut

Html Report (VSDrops) Download

❌ introspection tests

4 tests failed, 2 tests passed.

Failed tests

  • introspection/iOS - simulator/Debug: LaunchTimedOut
  • introspection/iOS - simulator/Debug (ARM64): LaunchTimedOut
  • introspection/tvOS - simulator/Debug: LaunchTimedOut
  • introspection/tvOS - simulator/Debug (ARM64): LaunchTimedOut

Html Report (VSDrops) Download

❌ linker tests (tvOS)

21 tests failed, 0 tests passed.

Failed tests

  • dont link/tvOS - simulator/Debug: LaunchTimedOut
  • dont link/tvOS - simulator/Release: LaunchTimedOut
  • dont link/tvOS - simulator/Debug (PrepareAssemblies, CoreCLR, Dynamic Registrar): LaunchTimedOut
  • dont link/tvOS - simulator/Debug (PrepareAssemblies, CoreCLR, Managed Static Registrar): LaunchTimedOut
  • dont link/tvOS - simulator/Debug (PrepareAssemblies, CoreCLR, Trimmable Static Registrar): LaunchTimedOut
  • dont link/tvOS - simulator/Release (PrepareAssemblies, CoreCLR, Dynamic Registrar): LaunchTimedOut
  • dont link/tvOS - simulator/Release (PrepareAssemblies, CoreCLR, Managed Static Registrar): LaunchTimedOut
  • dont link/tvOS - simulator/Release (PrepareAssemblies, CoreCLR, Trimmable Static Registrar): LaunchTimedOut
  • link sdk/tvOS - simulator/Debug: LaunchTimedOut
  • link sdk/tvOS - simulator/Release: LaunchTimedOut
  • link sdk/tvOS - simulator/Debug (PrepareAssemblies, CoreCLR, Trimmable Static Registrar): LaunchTimedOut
  • link sdk/tvOS - simulator/Release (PrepareAssemblies, CoreCLR, Trimmable Static Registrar): LaunchTimedOut
  • link all/tvOS - simulator/Debug: LaunchTimedOut
  • link all/tvOS - simulator/Release: LaunchTimedOut
  • link all/tvOS - simulator/Debug (PrepareAssemblies, CoreCLR, Trimmable Static Registrar): LaunchTimedOut
  • link all/tvOS - simulator/Debug (don't bundle original resources): LaunchTimedOut
  • link all/tvOS - simulator/Release (PrepareAssemblies, CoreCLR, Trimmable Static Registrar): LaunchTimedOut
  • trimmode copy/tvOS - simulator/Debug: LaunchTimedOut
  • trimmode copy/tvOS - simulator/Release: LaunchTimedOut
  • trimmode link/tvOS - simulator/Debug: LaunchTimedOut
  • trimmode link/tvOS - simulator/Release: LaunchTimedOut

Html Report (VSDrops) Download

❌ xcframework tests

2 tests failed, 2 tests passed.

Failed tests

  • xcframework-test/iOS - simulator/Debug: LaunchTimedOut
  • xcframework-test/tvOS - simulator/Debug: LaunchTimedOut

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
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: 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
✅ monotouch (iOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 24 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 24 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 21 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
✅ 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: b34c3c668927fd612e967e042ae0843926de23d6 [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