moo

Proper use of Cancellation Token => ThrowIfCancellationRequested() IL Code vs ‘real’

Hello all,I was writing my own custom userstore class (I have some specific authentication work to do, and its easier to write a custom one for my use-case) – when I was examining the IL decompliled Userstore Code I saw this:​Decompiled code using ‘Ride’ view source-code​Here is another screenshot of the full decompiled code​Questions​​#1 As developers, are we supposed to be calling: cancellationToken.ThrowIfCancellationRequested();or is this something that is only shown on the IL decompiled code?​#2 – What is the proper way to handle cancellation tokens in respect to ‘throwing’ and ‘handling’ cancellation events?​Edit:#3 – is there a reason why the decompiled code shows cancellation tokens used in this manner while the actual code from GitHub does not use cancellation tokens at all?I would love to hear your opinions on this.Thanks all via /r/csharp https://ift.tt/bEP0Q8s

Categories: Uncategorized