Skip to content

Use Mini dump in CrashDump child-crash test to fix macOS Debug timeout#8483

Closed
Evangelink wants to merge 3 commits into
mainfrom
dev/amauryleve/fix-crashdump-macos-debug-timeout
Closed

Use Mini dump in CrashDump child-crash test to fix macOS Debug timeout#8483
Evangelink wants to merge 3 commits into
mainfrom
dev/amauryleve/fix-crashdump-macos-debug-timeout

Conversation

@Evangelink
Copy link
Copy Markdown
Member

Fixes the consistent failure of CrashDump_TesthostAndChildBothCrash_CollectsAllDumps on macOS Debug builds.

Root cause

The default crash dump type is Full. On macOS Debug builds the runtime's createdump writes a multi-GB Full dump that can take several minutes per process. A representative failure log shows the parent's dump being a 5.6 GB file written in 198857ms (~3.3 minutes):

[createdump] Writing full dump to file .../CrashDump_11912_crash.dmp
[createdump] Writing full dump to file .../CrashDump_11901_crash.dmp
[createdump] Written 5648462104 bytes (1379019 pages) to core file
[createdump] Dump successfully written in 198857ms

The test parent only waits 60s on its spawned child via child.WaitForExit(60_000). On macOS Debug:

  1. Child FailFasts and createdump starts writing its (huge) dump.
  2. Parent's 60s wait expires while the child's dump is still being written.
  3. Parent calls child.Kill() and throws, interrupting the in-progress child dump ([createdump] Writing dump FAILED).
  4. Only the parent's dump ends up on disk -> Assert.HasCount(2, dumpFiles) fails (actual: 1).

Other configurations aren't impacted because Full dumps complete far faster on Windows/Linux and on Release builds.

Fix

Pass --crashdump-type Mini in this specific test. The DbgMiniDumpType env var set by CrashDumpEnvironmentVariableProvider is inherited by the spawned child process, so both processes write small/fast Mini dumps that comfortably finish within the 60s window.

The test only validates that both dumps are collected and reported as artifacts — it doesn't care about dump contents — so Mini is semantically equivalent for this scenario.

Copilot AI review requested due to automatic review settings May 22, 2026 08:58
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 addresses a macOS Debug CI timeout in the Microsoft.Testing.Platform CrashDump acceptance test by switching the test scenario to request Mini dumps, avoiding multi-GB Full dump creation delays that can exceed the test’s 60s child-process wait.

Changes:

  • Update CrashDump_TesthostAndChildBothCrash_CollectsAllDumps to pass --crashdump-type Mini and document the macOS Debug timeout root cause.
  • Simplify a filename-collision loop in TRX artifact copying logic.
  • Refactor HTML report target framework moniker selection into a single null-coalescing expression.
Show a summary per file
File Description
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs Requests Mini crash dumps in the child-crash scenario to prevent macOS Debug timeouts and improve test reliability.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Artifacts.cs Simplifies the destination-exists retry loop while preserving behavior.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportEngine.cs Refactors GetTargetFrameworkMoniker for equivalent, more concise logic.

Copilot's findings

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

Copy link
Copy Markdown
Member Author

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

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

8/8 applicable dimensions clean — no findings.

Reviewed dimensions:

  1. ✅ Algorithmic Correctness — Both refactorings are semantically identical to original code
  2. ✅ Threading & Concurrency — No new race conditions introduced (existing TOCTOU preserved)
  3. ✅ Performance & Allocations — No hot-path changes, refactorings have no performance impact
  4. ✅ Code Structure & Simplification — Excellent use of null-coalescing and while-condition extraction
  5. ✅ Test Completeness & Coverage — No new code paths require coverage
  6. ✅ Flakiness Patterns — Fix directly addresses root cause (timeout on macOS Debug Full dumps)
  7. ✅ Naming & Conventions — Consistent with codebase style
  8. ✅ Documentation Accuracy — New comment accurately explains WHY and mechanism

Skipped dimensions (not applicable): Security, Public API, Cross-TFM, Resource Management, Defensive Coding, Localization, Test Isolation, Assertion Quality, Data-Driven Coverage, Analyzer Quality, IPC Wire, Build Infrastructure, Scope Discipline.


Summary: This PR combines a targeted test fix (switching to --crashdump-type Mini to prevent macOS Debug timeouts) with two clean refactorings (null-coalescing chain, while-condition extraction). All changes preserve exact semantics. The test fix is well-documented and addresses the root cause identified in the PR description.

Generated by Expert Code Review (on open) for issue #8483 · ● 12.6M

On macOS Debug builds, createdump writes a multi-GB Full dump that can take 3+ minutes per process. The test parent waits only 60s on its spawned child via WaitForExit, so on macOS Debug the wait times out, the parent kills the child mid-dump, and only the parent's dump is left on disk — failing the HasCount(2) assertion.

Switch the test to '--crashdump-type Mini'. The DbgMiniDumpType env var set by CrashDumpEnvironmentVariableProvider is inherited by the spawned child, so both processes write small/fast Mini dumps and complete well within the 60s window. The test only validates that both dumps are collected and reported as artifacts — dump format is irrelevant for this scenario.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink force-pushed the dev/amauryleve/fix-crashdump-macos-debug-timeout branch from 221c058 to b76ac8e Compare May 22, 2026 09:27
@Evangelink
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

…ashdump-macos-debug-timeout

# Conflicts:
#	test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 12:25
@Evangelink Evangelink review requested due to automatic review settings May 22, 2026 12:25
Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

@copilot resolve the merge conflicts in this pull request

Merged origin/main into the branch and resolved the single conflict in CrashDumpTests.cs (both sides had the same functional change --crashdump-type Mini; only the comment text differed — kept the main branch version).

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.

3 participants