CRR0038 - The CancellationToken parameter is never used
This analyzer detects asynchronous methods that do not use the passed CancellationToken.
Task<string> DemoMethodAsync(CancellationToken token) {
DoThings();
return Task.FromResult("Success");
}
Function DemoMethodAsync(ByVal token As CancellationToken) As Task(Of String)
DoThings()
Return Task.FromResult("Success")
End Function
All asynchronous methods should accept the CancellationToken parameter and use it to cancel a task if task cancellation was requested. Refer to the Task Cancellation article for more information.
Task<string> DemoMethodAsync(CancellationToken token) {
token.ThrowIfCancellationRequested();
DoThings(token);
return Task.FromResult("Success");
}
Function DemoMethodAsync(ByVal token As CancellationToken) As Task(Of String)
token.ThrowIfCancellationRequested()
DoThings(token)
Return Task.FromResult("Success")
End Function
We are updating the DevExpress product documentation website and this page is part of our new experience. During this transition period, product documentation remains available in our previous format at documentation.devexpress.com. Learn More...