title: Returning a Task from a base method
body: <p>I am still in the process of getting a handle on asynchronous programming and a bit puzzled on how to modify the following:</p>
  
  <p><strong>base virtual method:</strong>  </p>
  
  <pre><code>public virtual async Task OnSuspendingAsync(object s, SuspendingEventArgs e)
  {
       // do some housekeeping actions upon suspending in the base class
  
       await Task.Yield();
  }
  </code></pre>
  
  <p><strong>overriding method:</strong>  </p>
  
  <pre><code>public override Task OnSuspendingAsync(object s, SuspendingEventArgs e)
  {
       // do some housekeeping actions on exiting/suspending
  
       return base.OnSuspendingAsync(s, e);
  }
  </code></pre>
  
  <p><strong>the question:</strong></p>
  
  <p>Now if I use an awaitable in the overridden method (almost unavoidable), I need to change <code>public override Task</code> to <code>public override async Task</code> by adding the <code>async</code> keyword as illustrated with a real example below.  </p>
  
  <pre><code>public override async Task OnSuspendingAsync(object s, SuspendingEventArgs e)
  {
     try
     {
       // tidy up app temporary folder on exit
       await ApplicationData.Current.ClearAsync(ApplicationDataLocality.Temporary);
     }
     catch { }
  
     return base.OnSuspendingAsync(s, e); // this is wrong with awaitable!
  }
  </code></pre>
  
  <p>In this case what should be the <code>return base.OnSuspendingAsync(s, e);</code> change to (and why) which Visual Studio is rightly flagging as an error?</p>