You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The internal timeout helper reports OperationCanceledException when a synchronous task factory observes its expired timeout token before returning a task. It should classify that cancellation as TimeoutException, just as it does when a returned task is canceled. This is a pre-existing edge case; the scheduled test-body path in #7527 does not exercise it.
Reproduction
In tests/TUnit.UnitTests/TimeoutHelperTests.cs, call the ordinary ExecuteWithTimeoutAsync overload with a short timeout and a synchronous factory that waits on token.WaitHandle, calls token.ThrowIfCancellationRequested(), then returns Task.CompletedTask. Assert TimeoutException. Also verify external cancellation keeps OperationCanceledException with the external token.
Expected and actual
Expected: timeout cancellation is classified consistently whether the factory throws synchronously or returns a canceled task. Actual: the factory invocation occurs outside the classification catch, so its synchronous exception escapes.
Route synchronous factory cancellation through the existing token-aware classification, preserving unrelated cancellation and diagnostic exceptions. Add synchronous-throw coverage alongside the returned-canceled-task case. Preserve timer-before-factory ordering and the scheduled-body timeout behavior.
Please make synchronous factory cancellation follow the same classification as returned task cancellation.
Activity
Suppress routine synchronous timeout diagnostics (#7532)
Fix synchronous factory timeout cancellation classification (#7561)