When clicking stop query, how to propagate CancellationToken

Hi,
Is it possible to do something like this?

async Task Main(CancellationToken token= default(CancellationToken))
{
// and when I press cancel on the LINQPad interface, it passing the cancelling request down
await SomeExternalLibCall(token);
}

That doesn't work. Is there an internal helper CancellationToken that work with the cancel button that I can use?

Currently, best I can do roll my own token source with a Timespan.
Thank you,
Art

Comments

  • There's a Cleanup event in the Util class:

    Util.Cleanup += (sender, args) => ...

    This fires just before the query is re-run or closed, and can be used to cancel any outstanding activity from the previous execution.
  • Thank you so much! :smiley:
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!