This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 8414 - Mono MCS cannot distinguish between calls to Task.Run with and without generic types
Summary: Mono MCS cannot distinguish between calls to Task.Run with and without generi...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-11-14 21:07 UTC by Brett van Swelm
Modified: 2012-11-16 07:59 UTC (History)
1 user (show)

See Also:
Tags:


Attachments

Description Brett van Swelm 2012-11-14 21:07:04 UTC
Mono MCS cannot distinguish between calls to Task.Run with and without generic types.

With "D:\Applications\Mono-2.11.4\bin" and "C:\Windows\Microsoft.NET\Framework\v4.0.30319" in the path on my Windows 7 machine:

===== AmbiguousGeneric.cs =====
using System;
using System.Threading;
using System.Threading.Tasks;

public class Something<T> {}

public class AmbiguousGeneric {
    public async void NestedVoidTestSuccess()
    {
        await Task.Run(async () => await ReturnOne());
    }
    private static Task<int> ReturnOne() {
        return Task.Run(() => 1);
    }
    public static void Main(String[] args) {}
} 
===== end =====

$ csc AmbiguousGeneric.cs
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.

$ mcs AmbiguousGeneric.cs
AmbiguousGeneric.cs(10,20): error CS0121: The call is ambiguous between the following methods or properties:
`System.Threading.Tasks.Task.Run(System.Func<System.Threading.Tasks.Task>)' and `System.Threading.Tasks.Task.Run<System.Threading.Tasks.Task<int>>(System.Func<System.Threading.Tasks.Task<int>>)'
D:\Applications\Mono-2.11.4\lib\mono\4.5\mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

Thanks,

Brett van Swelm | Senior Engineer
Coverity | 185 Berry Street | Suite 6500, Lobby 3 | San Francisco, CA 94107
The Leader in Development Testing
Read our profile in Forbes, Coverity Gets Code Right 25% Faster
Comment 1 Marek Safar 2012-11-16 07:59:28 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.