Bug 56062 - Task.Run no longer compiles
Summary: Task.Run no longer compiles
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 5.0.0 (2017-02)
Hardware: PC Mac OS
: --- critical
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2017-05-05 17:31 UTC by James Clancey
Modified: 2017-05-05 17:58 UTC (History)
2 users (show)

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:

Description James Clancey 2017-05-05 17:31:21 UTC
On iOS and Mac, the following code no longer compiles on iOS or MacOS:

void foo()
void bar()


Error CS0121: The call is ambiguous between the following methods or properties: 'Task.Run(Action)' and 'Task.Run(Func<Task>)'

I have a similar issue with Linq.Max(); which used to work which I think is related:

Error CS0121: The call is ambiguous between the following methods or properties: 'Enumerable.Max<TSource>(IEnumerable<TSource>, Func<TSource, int>)' and 'Enumerable.Max<TSource>(IEnumerable<TSource>, Func<TSource, int?>)'

=== Visual Studio for Mac Preview ===

Version Preview 10 (7.0 build 3051)
Installation UUID: bc6b1fbe-d3ff-45ec-a1ae-d8123578f97a
	Mono (2017-02/1d0445b) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500000094

=== NuGet ===


=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.1/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.Mac ===

Version: (Visual Studio Enterprise)

=== Xamarin.Android ===

Version: (Visual Studio Enterprise)
Android SDK: /Users/clancey/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3 (API level 10)
		5.1 (API level 22)
		6.0 (API level 23)
		7.0 (API level 24)
		7.1 (API level 25)

SDK Tools Version: 26.0.1
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Xamarin.iOS ===

Version: (Visual Studio Enterprise)
Hash: 30b6e87e
Branch: d15-2
Build date: 2017-04-28 17:17:13-0400

=== Build Information ===

Release ID: 700003051
Git revision: e5296061de5c6b093fb59668526728f2b82caa91
Build date: 2017-05-01 09:58:05-04
Xamarin addins: 7123ae956f3089f398cc9eae6bba94037ca896e6
Build lane: monodevelop-lion-d15-2

=== Operating System ===

Mac OS X 10.12.4
Darwin 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
Comment 1 Marek Safar 2017-05-05 17:34:04 UTC
This is csc bug/feature.
Comment 2 Miguel de Icaza [MSFT] 2017-05-05 17:43:29 UTC
Do we have an upstream bug to track this issue?
Comment 3 Miguel de Icaza [MSFT] 2017-05-05 17:58:18 UTC
Marek provided it for me.

This is the bug in Roslyn, with a test case: