title: await operator can only be used within an async method - but method is asynchron
body: <p>I want to use a MessageDialog in VS12. Until now I have used:</p>
  
  <pre><code>MessageDialog msgdlg = new MessageDialog("Choose a color", "How To Async #1");
  msgdlg.DefaultCommandIndex = 1;
  msgdlg.Commands.Add(new UICommand("Red", null, Colors.Red));
  msgdlg.Commands.Add(new UICommand("Green", null, Colors.Green));
  msgdlg.Commands.Add(new UICommand("Blue", null, Colors.Blue));
  
  IAsyncOperation&lt;IUICommand&gt; asyncOp = msgdlg.ShowAsync();
  asyncOp.Completed = OnMessageDialogShowAsyncCompleted;
  </code></pre>
  
  <p>Now I want to eliminate the callbacks and use an anonymous methode with await. For test purpose i used:</p>
  
  <pre><code>MessageDialog msgdlg = new MessageDialog("Choose a color", "#3");
  msgdlg.Commands.Add(new UICommand("Red", null, Colors.Red));
  msgdlg.Commands.Add(new UICommand("Green", null, Colors.Green));
  msgdlg.Commands.Add(new UICommand("Blue", null, Colors.Blue));
  
  // Show the MessageDialog
  IAsyncOperation&lt;IUICommand&gt; asyncOp = msgdlg.ShowAsync();
  IUICommand command = await asyncOp;
  </code></pre>
  
  <p>Problem is, await produces an error, even if ShowAsync() is obviously asynchron. "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'."</p>
  
  <p>Whats the problem here?</p>
  
  <hr>
  
  <p>Ok, thanks to your comments I now doing this:</p>
  
  <pre><code>Loaded += async (sender, args) =&gt;
          {
              #region Using await (from C# 5.0 on)
              MessageDialog msgdlg = new MessageDialog("Choose a color", "#3");
              msgdlg.Commands.Add(new UICommand("Red", null, Colors.Red));
              msgdlg.Commands.Add(new UICommand("Green", null, Colors.Green));
              msgdlg.Commands.Add(new UICommand("Blue", null, Colors.Blue));
  
              // Show the MessageDialog
              IAsyncOperation&lt;IUICommand&gt; asyncOp = msgdlg.ShowAsync();
              IUICommand command = await asyncOp;
  
              #endregion
          };
  </code></pre>
  
  <p>Now it works - thanks a lot!</p>