Skip to content

[Bug] A hung runtime test with no [Timeout] discards the whole shard's results #24471

Description

@MartinZikmund

Current behavior 🐛

UnitTestsControl only applies a timeout to a test body when the method carries an explicit [Timeout] attribute:

var timeout = GetTestTimeout(test);
if (timeout.HasValue)
{
    // Task.WhenAny(task, Task.Delay(timeout.Value)) ...
}
else
{
    await task;   // <- awaited forever
}
private TimeSpan? GetTestTimeout(UnitTestMethodInfo test)
    => test.Method.GetCustomAttribute(typeof(TimeoutAttribute)) is TimeoutAttribute methodAttribute
            ? TimeSpan.FromMilliseconds(methodAttribute.Timeout)
            : null;

DefaultUnitTestTimeout exists, but WaitResult applies it only to the initialize/cleanup steps, never to the test body.

So a single hung async test with no attribute is awaited forever. The results XML is never written, and the job dies on the harness or job timeout instead — discarding every result in that shard, including up to ~1750 that already passed, and every failing test name. The run reports only an opaque "no results file" error.

This is an amplifier: three unrelated WebAssembly failure mechanisms (the sample runner never registering, a mid-run hang, and heap exhaustion) all collapse into the same undiagnosable symptom because of it. It is also why failures inside timed-out jobs never reach any flakiness analysis — they contribute zero rows.

Expected behavior 🎯

A test that hangs is reported as one named failing test, and the rest of the shard's results are still published. [Timeout] should override a default rather than being the only source of one.

How to reproduce it 🔬

Add a runtime test with no [Timeout] whose returned Task never completes, and run the suite. The harness hangs until the job is killed; no results XML is produced and no test is named.

Workaround 🛠️

Put an explicit [Timeout] on every async test — impractical across the suite.

Note on choosing a default

The existing DefaultUnitTestTimeout is 60 s in Release, which is too low to reuse here. Measured per-test durations on healthy agents:

platform p50 p99 max
Android Skia (4736 tests) 0.1 s 1.2–2.6 s 34.1 s (When_Polyline)
WebAssembly Skia (6039 tests) 0.03 s ~3 s 76.5 s (When_Line)

The shape-parity tests legitimately reach ~77 s on WebAssembly, so a 60 s default would turn currently-green builds red.

Affected platforms

All — the runtime-test harness is shared. Most visible on WebAssembly and Android.

Activity

  1. added
    kind/bug
    triage/untriaged
    on Sep 9, 2026
  2. self-assigned this
    on Sep 9, 2026
  3. added theissue type on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/cikind/bugtriage/untriaged

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions