Code Challenge: Make the assertion fire
Can you create a calling code that would make this code fire the assertion?
public static IEnumerable<int> Fibonnaci(CancellationToken token) { yield return 0; yield return 1; var prev = 0; var cur = 1; try { while (token.IsCancellationRequested == false) { var tmp = prev + cur; prev = cur; cur = tmp; yield return tmp; } } finally { Debug.Assert(token.IsCancellationRequested); } }
Note that cancellation token cannot be changed, once cancelled, it can never revert.

Comments
Comment preview