title: C# - Create new exception without losing stack trace and inner exceptions?
body: <p>I have a method that provides an Exception object and I want to log an error if anything happens in the error handler itself. Here is some pseudocode:</p>
  
  <pre><code>public override void OnError(Exception originalException)
  {
      try
      {
          // Do work...
      }
      catch (Exception e)
      {
          // How do I create this exception without losing the stack 
          // trace of e and preserving any inner exceptions that were 
          // in e at the same time including the details of 
          // originalException?
          Exception newException = new Exception(e.Message, originalException);
          Logger.Error("An error occurred", newException);
      }
  }
  </code></pre>
  
  <p>Basically, I am trying to combine originalException and e above into one Exception message to pass to a logger object. I suppose one option would be to create 2 separate log messages but it's not ideal.</p>