Bug 18551 - CS0029 error when calling TaskFactory.ContinueWhenAll
Summary: CS0029 error when calling TaskFactory.ContinueWhenAll
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-03-24 09:29 UTC by Andreas Spengler
Modified: 2014-05-02 11:55 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 NOT_REPRODUCIBLE

Description Andreas Spengler 2014-03-24 09:29:50 UTC
I am new to C#/.net development and am looking at some Extension methods from MSDN used in their Parallel Programming examples:

using System.Collections.Generic;

namespace System.Threading.Tasks
{
    public static partial class TaskFactoryExtensions
    {

        // Works
        public static Task<Task[]> WhenAll(
            this TaskFactory factory, params Task[] tasks)
        {
            return factory.ContinueWhenAll(tasks, completedTasks => completedTasks);
        }

        // CS0029 error
        public static Task<Task<TAntecedentResult>[]> WhenAll<TAntecedentResult>(
            this TaskFactory factory, params Task<TAntecedentResult>[] tasks)
        {
            return factory.ContinueWhenAll(tasks, completedTasks => completedTasks);
        }
        ...
    }
}

The first extension is ok, it is using the method

  public Task ContinueWhenAll (Task[] tasks, Action<Task[]> continuationAction)

from the System.Threading.Tasks.TaskFactory class.


The second extension however gives 

Error CS0029: Cannot implicitly convert type `System.Threading.Tasks.Task<System.Threading.Tasks.Task[]>' to `System.Threading.Tasks.Task<System.Threading.Tasks.Task<TAntecedentResult>[]>' (CS0029) (ParallelExtensionsExtras)

although there exists a method 

  public Task ContinueWhenAll<TAntecedentResult>(
             Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction)
Comment 1 Marek Safar 2014-05-02 11:55:34 UTC
Works fine with Mono 3.4.0 and most likely 3.2.x versions as well