nevyn/SPAsync — pull request #2 by wader (2013-07-07 17:43:14+00:00)
Title: Propagate cancel to chained task even if source task is completed

Currently a chained task created when the source of a chain is completed would not get cancelled if the source for some reason get cancelled even if it previously was completed.

This change solve this by adding the chained task as a child task of the chain task.

--

I was hit by this behaviour when using tasks to do delayed image loading over network for table view cells. As i only kept a reference to the delayed task per cell and not the delayed chained image loading task a cancel in a situation were the delayed task had completed would not cancel the image loading task causing it to trigger it's callback even if the whole chain was cancelled.

Im not sure if this is the correct solution but i think it makes sense. But maybe a better solution is to introduce something like [Cancellation Token](http://msdn.microsoft.com/en-us/library/dd997396.aspx)? (thanks @niik for explaining .NET task cancellation to me!)