Skip to content
Latchkey

dotnet test "Testhost process crashed" during the run in CI

The test host process running your tests died mid-run, so VSTest aborts. A crash points at the process, not an assertion: a native dependency, a stack overflow, an OOM kill, or an unhandled fault in a background thread.

What this error means

dotnet test fails with "The active test run was aborted. Reason: Test host process crashed" and may report some tests as not run.

dotnet
The active test run was aborted. Reason: Test host process crashed :
Stack trace ... at MyApp.Tests... Aborting test run.

Common causes

A native dependency or OOM kills the host

A native library fault or the runner running out of memory terminates the test host before tests finish.

An unhandled exception on a background thread

A fault escaping a non-test thread or a StackOverflowException crashes the process rather than failing a single test.

How to fix it

Capture a crash dump and read it

  1. Enable blame/crash dump collection so the host crash is recorded.
  2. Inspect the dump and stack to find the faulting code or library.
  3. Fix the native dependency or unhandled exception it points to.
Terminal
dotnet test --blame-crash --blame-hang-timeout 5m

Provision missing native dependencies / memory

Install the system libraries the tests load, and ensure the runner has enough memory for the suite.

Terminal
sudo apt-get update && sudo apt-get install -y libgdiplus

How to prevent it

  • Run with --blame-crash in CI so failures leave a dump.
  • Install native dependencies tests rely on in a setup step.
  • Right-size runner memory for memory-heavy suites.

Frequently asked questions

What causes ""Testhost process ... crashed""?
A native library fault or the runner running out of memory terminates the test host before tests finish.
How do I fix "Testhost process ... crashed"?
Capture a crash dump and read it

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card