title: Serializing exceptions over WCF
body: <p>I have a task running on a remote system connecting back to a server using WCF. It is very possible that the task can throw exceptions, and I'd like those exceptions to be channeled back to the server. Essentially I want to do something like this:</p>
  
  <p>Client:</p>
  
  <pre><code>server.SendException(new UnauthorizedAccessException("Some Exception"));
  </code></pre>
  
  <p>Server:</p>
  
  <pre><code>public void SendException(Exception e)
  {
      throw e;
  }
  </code></pre>
  
  <p>Contract:</p>
  
  <pre><code>[ServiceContract]
  public interface IServerContract
  {
      [OperationContract]
      void SendException(Exception e);
  }
  </code></pre>
  
  <p>I've been reading a little bit about fault exceptions, but from what I understand, they are used for specific exceptions that are running in a method called over WCF. What I want is to send any type of exception that the application has thrown outside of WCF context, and then channel them back to the server for further processing. If it helps in a solution, the server also has a connection back to the client.</p>