Repository navigation
Description
Problem
The new CMTK0003 task-combinator handling only considers the outer combinator's failure behavior. An awaited Task.WhenAll or Task.Run can carry a nested assertion task as a successful value rather than observe its failure, but the analyzer reports nothing.
Reproduced at release tip 9878a6cb7500dbf7d3e1a199c3b9446d7e5cc278, using the real built analyzer and Testing assemblies with Roslyn Compilation.WithAnalyzers. The snippets have no compiler errors:
public static async Task Check(Task<Option<int>> first, Task<Option<int>> second)
{
await Task.WhenAll(Task.WhenAny(first.ShouldBeNone(), second.ShouldBeNone()));
await Task.Run(() => Task.WhenAny(first.ShouldBeNone(), second.ShouldBeNone()));
}Neither line produces CMTK0003. The same loss is silent through .Wait() and an implicit plain-Task return:
Task.WhenAll(Task.WhenAny(first.ShouldBeNone(), second.ShouldBeNone())).Wait();
Func<Task> check = () => Task.WhenAll(Task.WhenAny(first.ShouldBeNone(), second.ShouldBeNone()));A runtime check with Some(42) confirmed that both awaited outer combinators complete successfully while the Task returned as their value is faulted with TypeKitAssertionException. Thus a test can contain await on every statement and still pass when all the assertions fail.
Cause
IgnoredOutcomeAnalyzer.DroppedAssertion suppresses the check whenever awaited and Tasks.PassesOnFailure for the outer method is true. WhenAll and Run pass on failures of the tasks they await, but an inner WhenAny never faults; it hands on the assertion's task as its value. The current check does not preserve that distinction through nesting.
Expected
Preserve failure observation through nested combinators rather than treating an awaited outer WhenAll/Run as observing all descendant assertions. Add compositions to DroppedTaskShapes: a non-faulting inner combinator under WhenAll/Run, through await/Wait/plain-Task conversion, versus a genuinely observed assertion and await await Task.WhenAny(...) as a silent control.
Direct dropped WhenAll and directly awaited WhenAny are now correctly diagnosed, and the original #152 wrapper/branch examples are fixed. This is a further composition gap in the new reach, found in the second pre-release review. Decide and fix before the tag under decision 119.
Activity
CaffeinatedCoder commentedon Oct 29, 2026
Fixed in #172 (into
release/2.3.0, commit f636a06).HandsOnnow returns how deep the statement holds the failure: 0 where the task faults with it (WhenAll,Run), +1 per task that completes with it as a value (WhenAny,WhenEach, anasynclambda that returns it), −1 perawaitthat unwraps one. An awaited, waited-for or plain-Taskcombinator observes only depth 0. Soawait Task.WhenAll(Task.WhenAny(…)),await Task.Run(() => Task.WhenAny(…)), their.Wait()andFunc<Task>forms report at any depth;await await Task.WhenAny(…)stays silent.Task.WaitAll(Task.WhenAny(…))was already reported once, at the WhenAny's conversion. DroppedTaskShapes gained the nesting matrix (each combinator inside each other, three and four deep, arrays, Selects, async lambdas awaiting once/twice/three times), assertion-only: tasks ofResultkeep 2.2.0's rule. Not reached, silent: severalawaits at the statement root (await await Task.WhenAny(Task.WhenAny(…))).CaffeinatedCoder commentedon Oct 29, 2026
Fixed by #172, merged into
release/2.3.0.