I built a small chain of tasks with conditional continuations, however I'm experiencing some weired behavior. My chain looks like this:
LoadSettings (OnlyOnFaulted)-> ErrorHandler (none)-> Cleanup (none)-> Exit
| (OnlyOnRanToCompletion)
CheckForUpdates (OnlyOnFaulted)-> ErrorHandler (none)-> Cleanup (none)-> Exit
| (OnlyOnRanToCompletion)
Update (OnlyOnFaulted)-> ErrorHandler (none)-> Cleanup (none)-> Exit
| (OnlyOnRanToCompletion)
Cleanup (OnlyOnFaulted)-> ErrorHandler (none)-> Exit
| (OnlyOnRanToCompletion)
Exit
As I understood this chain should run asynchronically (i.e. not in the ui thread) but one after another (so LoadSettings -> CheckForUpdates -> ...).
However I get this behavior:
LoadSettings -> CheckForUpdates -> Cleanup -> Exit -> Cleanup -> ...
Also, the first Cleanup gets called with the Task id 1 as parameter (this is the task executed right before, right?) and this Task had the status Canceled (and I never cancel a Task anywhere).
Does anyone know what's going wrong here?
Edit: Ok, according to msdn if a condition for a continuation is not met its task get canceled. So ErrorHandler gets canceled, but how can I stop the complete chain (or notify the other continuations with cleanup and exit that it has been canceled)?