title: A Generic error occurs at GDI+ at Bitmap.Save() after using SaveFileDialog
body: <p>I use the following code block with some more code inside the using block:</p>
  
  <pre><code>using (System.Drawing.Bitmap tempImg =
         (System.Drawing.Bitmap)tempObj.GetData(System.Windows.Forms.DataFormats.Bitmap))
  {
      // ...
      tempImg.Save("..\\..\\testdata\\tempImg.bmp", ImageFormat.Bmp);                            
      // ...
  }
  </code></pre>
  
  <p>But I still get the error:</p>
  
  <blockquote>
    <p>A Generic Error occured at GDI+</p>
  </blockquote>
  
  <p>only after I make some action which is not related to the code inside the using block. In other times this works well.
  Also the tempImg.bmp is a temporary file, so I delete the tempImg.bmp within the using block itself. </p>
  
  <p>Since the tempImg is inside the using and this it's disposed, I think the locking problem should be solved. </p>
  
  <p>Can someone please let me know what is the mistake in this code?    </p>
  
  <p><strong>Edit:</strong>
  <code>System.Drawing.Image</code> to <code>System.Drawing.Bitmap</code> as the type of <code>tempImg</code>.</p>
  
  <p><strong>Edit:</strong>
  I have identified I get this error only after SaveFileDialog is created and user clicks on 'Save'.</p>