title: How to include actual Exception or Custom Exception in FaultContract of WCF
body: <p>I would like to Include a User Define Exception in FaultContract of WCF.
  In my WCF application, I would like to encapsulate Exception instance/UserDefine Exception Instance in FaultContract.
  Please Find my below UserDefine Exception.</p>
  <pre><code>public class UserExceptions : Exception
  {
      public string customMessage { get; set; }
  
      public string Result { get; set; }
  
      public UserExceptions(Exception ex):base(ex.Message,ex.InnerException)
      {
  
      }
  }
  
  public class RecordNotFoundException : UserExceptions
  {
      public RecordNotFoundException(Exception ex): base(ex)
      {
  
      }
  }
  
  public class StoredProcNotFoundException : UserExceptions
  {
      public string innerExp { get; set; }
  
      public StoredProcNotFoundException(Exception ex,string innerExp)
          : base(ex)
      {
          this.innerExp = innerExp;
      }
  }
  
  [DataContract]
  public class ExceptionFault
  { 
      [DataMember]
      public UserExceptions Exception { get; set; }
  
      public ExceptionFault(UserExceptions ex)
      {
          this.Exception = ex;
      }
  }
  </code></pre>
  <p>And I am throw Exception in service as below</p>
  <pre><code>try
          {
              //Some Code
              //Coding Section 
                      throw new RecordNotFoundException(new Exception(&quot;Record Not Found&quot;));
              //Coding Section
          }
          catch (RecordNotFoundException rex)
          {
              ExceptionFault ef = new ExceptionFault(rex);
              throw new FaultException&lt;ExceptionFault&gt;(ef,new FaultReason(rex.Message));
          }
          catch (Exception ex)
          {
              throw new FaultException&lt;ExceptionFault&gt;(new ExceptionFault((UserExceptions)ex),new FaultReason(ex.Message));
          }
  </code></pre>
  <p>try block catch CustomException(RecordNotFoundException) but it is not able to send that exception to client.</p>