Bug 11008 - Task.WhenAny should remove continuations on uncompleted tasks
Summary: Task.WhenAny should remove continuations on uncompleted tasks
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-03-08 15:22 UTC by Daniel
Modified: 2013-03-18 04:33 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Daniel 2013-03-08 15:22:23 UTC
Please have a look at my StackOverflow question: http://stackoverflow.com/questions/15275932/will-task-whenany-unregister-continuations-on-unfinished-tasks

Answers suggest that in Microsofts .net implementation, task continuations are indeed unregistered on uncompleted tasks. However, after browsing Mono's source code (specifically the WhenAnyContinuation class in mono/mcs/class/corlib/System.Threading.Tasks/TaskContinuation.cs) it seems that this property does not hold in Mono. The code example in the StackOverflow question shows a scenario where an unbounded number of continuations may be registered on a task, causing a memory leak, so Task.WhenAny should remove continuations on uncompleted tasks when one of the supplied tasks finish.
Comment 1 Marek Safar 2013-03-18 04:33:56 UTC
Fixed in master