title: CancellationTokenSource.Cancel() hangs
body: <p>I'm observing hang in <code>CancellationTokenSource.Cancel</code> when one of the async is in an active loop.</p>
  
  <p>Full code:</p>
  
  <pre><code>static async Task doStuff(CancellationToken token)
  {
      try
      {
          // await Task.Yield();
          await Task.Delay(-1, token);
      }
      catch (TaskCanceledException)
      {
      }
  
      while (true) ;
  }
  
  static void Main(string[] args)
  {
      var main = Task.Run(() =&gt;
      {
          using (var csource = new CancellationTokenSource())
          {
              var task = doStuff(csource.Token);
              Console.WriteLine("Spawned");
              csource.Cancel();
              Console.WriteLine("Cancelled");
          }
      });
      main.GetAwaiter().GetResult();
  }
  </code></pre>
  
  <p>Prints <code>Spawned</code> and hangs. Callstack looks like:</p>
  
  <pre><code>ConsoleApp9.exe!ConsoleApp9.Program.doStuff(System.Threading.CancellationToken token) Line 23   C#
  [Resuming Async Method] 
  [External Code] 
  ConsoleApp9.exe!ConsoleApp9.Program.Main.AnonymousMethod__1_0() Line 34 C#
  [External Code] 
  </code></pre>
  
  <p>Uncommeting <code>await Task.Yield</code> would result in <code>Spawned\nCancelled</code> in output.</p>
  
  <p>Any ideas why? Does C# guarantee that once-yielded async would never block other asyncs?</p>