Skip to main content

Practice ยท 5 of 5

Debug: The Exception That Vanished

CHALLENGE
Difficulty: intermediate+25 XP

SaveAllAsync fires SaveAsync for each item but never awaits the tasks โ€” one throws and the failure disappears (the harness detects faults left unobserved). Fix: fan out AND observe every completion, rethrowing the first failure after all settle. ``csharp public sealed class SaveTrap { public SaveTrap(params string[] failingKeys); // provided public Task SaveAsync(string key); // provided: throws for failingKeys } static Task SaveAllAsync(SaveTrap trap, IEnumerable<string> keys); ``

Back to lesson: Practice: Async Practice: Fetch, Fan-out, Cancel