Top "Cancellationtokensource" questions

Provides a cancellation token in .NET for cooperative cancellation of asynchronous or long-running synchronous operations.

Error: The operation was canceled

I'm using this code snippet to do an async query with a cancellation token: var _client = new HttpClient( /* some setthngs */ ); _…

c#-4.0 asynchronous async-await cancellation cancellationtokensource
Canceling SQL Server query with CancellationToken

I have a long-running stored procedure in SQL Server that my users need to be able to cancel. I have …

c# sql-server async-await cancellationtokensource
Correct use of CancellationToken

This is my situation: private CancellationTokenSource cancellationTokenSource; private CancellationToken cancellationToken; public IoTHub() { cancellationTokenSource = new CancellationTokenSource(); cancellationToken = cancellationTokenSource.Token; receive(); } private …

c# cancellationtokensource cancellation-token
TaskCanceledException when calling Task.Delay with a CancellationToken in an keyboard event

I am trying to delay the processing of a method (SubmitQuery() in the example) called from an keyboard event in …

c# asynchronous windows-runtime cancellationtokensource cancellation-token
How do you catch CancellationToken.Register callback exceptions?

I am using async I/O to communicate with an HID device, and I would like to throw a catchable …

c# task-parallel-library cancellationtokensource
CancellationTokenSource.Cancel is throwing an exception

As I read the documentation CancellationTokenSource.Cancel is not supposed to throw an exception. CancellationTokenSource.Cancel Below the call to …

c# .net task wait cancellationtokensource
How to cancel a Task using CancellationToken?

So I've this code: //CancelationToken CancellationTokenSource src = new CancellationTokenSource(); CancellationToken ct = src.Token; ct.Register(() => Console.WriteLine("Abbruch des …

c# task-parallel-library task cancellationtokensource
How to cancel a running task?

I want to cancel a running task (when the users presses the escape key). when i click on "escape" key …

c# task cancellation cancellationtokensource cancellation-token
How to cancel an async WCF call?

I have been trying some time to find out how to implement WCF call cancellation based on the new .NET 4.5 …

c# wcf asynchronous service cancellationtokensource