The 'await' operator can only be used within an async method.
While I was coding during a task in Windows Phone 8 app development, I got the following error message from Microsoft Visual Studio 2012 IDE.
The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
I soon realized that I was to in a hurry to place the async task launcher code in the tap event code in code behind of the Windows Phone page. When I added the async method identifier the error is resolved by itself.
For example, in the following button on tap event code, instead of running the LaunchUriAsync() method I placed the same code in a new method marked with async keyword.
By the way, Windows Phone app developers can use the above sample C# code to open the default Wi-Fi settings app from their Windows Phone 8 program.
The above change helped me to resolve the "The 'await' operator can only be used within an async method." error message.