Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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
Developer Community or GitHub 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.
Receive the title error when building on the line:
await player.PrepareAsync ();
Code is in an async method. In this case, turning the strtPlayer () method in the Example_WorkingWithAudio sample to async and changing 'player.Prepare ()' to 'await player.PrepareAsync ()'. The project builds successfully without the await keyword.
/Users/Tim/Projects/Xamarin/monodroid-samples/Example_WorkingWithAudio/Example_WorkingWithAudio/PlayAudio.cs(18,18): Error CS4001: Cannot await `void' expression (CS4001) (Example_WorkingWithAudio)
OS X 10.8.4
Just because a method has an "Async" suffix doesn't mean that it follows the C#5 async method pattern, especially when nothing prevents Java from having "Async"-suffixed methods.
Case in point, MediaPlayer.prepareAsync() is a Java method, and it returns `void`:
Our "asyncification" effort adds "Async overloads" for non-async methods. It does NOT change Java-defined methods which happen to match the C#5 async naming convention so that they conform to the C#5 async pattern.