title: GDI+ General Error on ScreenShot
body: <p>I have the below Exception Extension for my in house Winform App.  My problem is that I get a <code>generic GDI+</code> error on <code>ss.save("C:\\HelpMe.jpg", ImageFormat.Jpeg);</code>  </p>
  
  <p>It is not every time as it will work and then error out.  Sometimes it will work a couple of times in a row.</p>
  
  <p>Is this a "locking" issue, possibly?  What else should I look at and/or am doing wrong.</p>
  
  <p>I call this like so --></p>
  
  <hr>
  
  <pre><code>catch (Exception ex)
          {
              ex.LogError(HUD.ShellForm);
          }
  </code></pre>
  
  <hr>
  
  <pre><code>public static void LogError(this Exception exception, DevExpress.XtraEditors.XtraForm whichForm)
      {
          GetDesktopImage(whichForm);
          SendExceptionMail(exception);
  
          ExceptionMessageBox box = new ExceptionMessageBox(exception);
          box.Show(whichForm);
      }
  
      private static void SendExceptionMail(Exception exception)
      {
          SmtpClient smtpClient = new SmtpClient("MailServer");
  
          MailMessage message = new MailMessage
              {
                  From = new MailAddress("MATRIX@anEmail"),
                  Subject = "MATRIX Application Error",
                  Body = exception.Message
              };
  
          Attachment attachment = new Attachment(@"C:\\HelpMe.jpg");
          message.Attachments.Add(attachment);
  
          message.To.Add("Developer@anEmail");
          message.To.Add("HelpDesk@anEmail");
          smtpClient.Send(message);
      }
  
      ///&lt;summary&gt;
      /// Grabs a screen shot of the App and saves it to the C drive in jpg
      ///&lt;/summary&gt;
      private static void GetDesktopImage(DevExpress.XtraEditors.XtraForm whichForm)
      {
          Rectangle bounds = whichForm.Bounds;
  
          using (Bitmap ss = new Bitmap(bounds.Width, bounds.Height))
          using (Graphics g = Graphics.FromImage(ss))
          {
              g.CopyFromScreen(whichForm.Location, Point.Empty, bounds.Size);
              ss.Save("C:\\HelpMe.jpg", ImageFormat.Jpeg);
          }
      }
  </code></pre>