.net

An async problem

Posted on:

Imagine you have an asynchronous cancellable method like this: CancellationTokenSource cts; async Task DoSomethingAsync() { if (cts != null) cts.Cancel(); cts = new CancellationTokenSource(); try { await AnAsyncMethodAsync(cts.Token); […]