Skip to content

--hangdump-timeout is for the whole test run instead of per-test on macOS #7060

Closed as duplicate

Description

Describe the bug

When using the --hangdump-timeout option, the value is considered for the entire test run on macOS. I would expect --hangdump-timeout to be the equivalent of --blame-hang-timeout, which is per-test. It is per-test on Windows.

Steps To Reproduce

  1. Create an xunit v3 test project
    dotnet new install xunit.v3.templates
    dotnet new xunit3 -o xunit-test
    
  2. Add a reference to Microsoft.Testing.Extensions.HangDump
  3. Add the following test methods:
    [Fact]
    public void Test1() => Thread.Sleep(2000);
    
    [Fact]
    public void Test2() => Thread.Sleep(2000);
  4. Build and run the tests, specifying 3s as the timeout:
    xunit3-test --hangdump --hangdump-timeout 3s --no-progress --output Detailed

Expected behavior

The --hangdump-timeout of 3s is per-test and the test run does not hit the timeout. This is the case when running on Windows.

passed xunit3_test.UnitTest1.Test1 (2s 010ms)
passed xunit3_test.UnitTest1.Test2 (2s 001ms)

Actual behavior

The --hangdump-timeout of 3s appears to be for the entire test run, so the run hits the timeout and fails. This happens on macOS, but not Windows.

passed xunit3_test.UnitTest1.Test1 (2s 011ms)
Hang dump timeout of '00:00:03' expired
Dumping process 52649 - xunit3-test
The following tests were still running when dump was taken (format: [<time-elapsed-since-start>] <name>):
[00:00:01] xunit3_test.UnitTest1.Test2

Additional context

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />

I have tried this with both MTP v2:

<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.1" />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="2.0.2" />

And v1:

<PackageReference Include="xunit.v3" Version="3.2.1" />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="1.9.1" />

Activity

  1. added
    resolution/by-design
    and removed
    needs/triage
    resolution/by-design
    on Dec 15, 2025
  2. nohwnd commented on Dec 15, 2025

    @nohwnd
    Member

    Hello,
    this was recently fixed, and we will release the fix in mstest 4.1 / mtp 2.1 #7005
    On MacOS the Monitor that is used for indication of activity (tests are starting and finishing) does not reset.

    This causes the test run controller to never receive a heartbeat from the test runner, and the run exits after the hang dump timeout, even though test are running.

    I would expect --hangdump-timeout to be the equivalent of --blame-hang-timeout, which is per-test. It is per-test on Windows.

    This is not how hangdump is designed to work. It has a single timer, and it will dump when there is no activity for the given period of time. In other words with timeout of 20s, you can still run a test that takes 3 minutes, as long as there are other tests running in parallel starting at least every 20s. This will give you a hang dump of tests that would otherwise hang forever, and most likely there won't be any tests that are just "randomly" running at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions