Bug 6037 - async keyword appears to not be contextual in a ? b : c
Summary: async keyword appears to not be contextual in a ? b : c
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-07-08 13:31 UTC by James Bellinger
Modified: 2012-07-09 11:58 UTC (History)
1 user (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 Bellinger 2012-07-08 13:31:20 UTC
See http://msdn.microsoft.com/en-us/library/hh156513%28v=vs.110%29.aspx for 'async keyword should be contextual'.

I was using it as 'bool async' parameter and then later as 'async ? a : b' and the Mono compiler has a problem with this latter use, saying:

Test/System.IO.Pipes/PipeSecurityTest.cs(177,38): error CS0103: The name `Async' does not exist in the current context

Notice it also alters the casing...
Comment 1 Marek Safar 2012-07-09 03:43:38 UTC
I cannot reproduce the issue

my sample compiles fine with 2.11

class C
	public static void Foo (bool async)
		int a = 0;
		int b = 2;
		var r = async ? a : b;
	public static void Main ()
Comment 2 James Bellinger 2012-07-09 10:21:01 UTC
System.Core/Test/System.IO.Pipes/PipeSecurityTest.cs is where I was running into this issue.

If you replace the four @async with async you will encounter it.
Comment 3 Marek Safar 2012-07-09 11:58:30 UTC
Fixed in master