title: How to handle Service References in Windows Phone 8 without Task-Based proxies
body: <p>With so much emphasis on Task-Based asynchronous development, I was surprised to see that Service References in Windows Phone 8 do not support task-based implementations. Instead they use a "XYZCompleted" event-based asynchronous approach. </p>
  
  <p>As a result, code like this is necessary: <a href="http://codepaste.net/fqyt47" rel="nofollow">http://codepaste.net/fqyt47</a></p>
  
  <pre><code>public async Task&lt;IEnumerable&lt;MyService.Character&gt;&gt; GetCharactersAsync()
  {
      var _Task = new TaskCompletionSource&lt;IEnumerable&lt;MyService.Character&gt;&gt;();
      var _Client = new MyService.ServiceClient();
      _Client.GetCharactersCompleted += (s, e) =&gt;
      {
          var _Characters = e.Result as IEnumerable&lt;MyService.Character&gt;;
          if (e.Error != null &amp;&amp; !_Task.TrySetException(e.Error))
              System.Diagnostics.Debugger.Break();
          else if (e.Cancelled &amp;&amp; !_Task.TrySetCanceled())
              System.Diagnostics.Debugger.Break();
          else if (!_Task.TrySetResult(_Characters))
              System.Diagnostics.Debugger.Break();
      };
      _Client.GetCharactersAsync();
  
      return await _Task.Task;
  }
  </code></pre>
  
  <p>However, <strong>this feels wrong</strong>. Is there a better, more elegant approach?</p>