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.
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
- Enable blame/crash dump collection so the host crash is recorded.
- Inspect the dump and stack to find the faulting code or library.
- Fix the native dependency or unhandled exception it points to.
dotnet test --blame-crash --blame-hang-timeout 5mProvision missing native dependencies / memory
Install the system libraries the tests load, and ensure the runner has enough memory for the suite.
sudo apt-get update && sudo apt-get install -y libgdiplusHow to prevent it
- Run with
--blame-crashin CI so failures leave a dump. - Install native dependencies tests rely on in a setup step.
- Right-size runner memory for memory-heavy suites.