var Bitmap = Screenshot.CapturedBitmap.ToBitmap();
Bitmap.Save(PathToFile);
fails with the "Cannot access closed stream" exception.
Extension method BitmapExtension.ToBitmap is flawed. MSDN states that one must keep the stream open for the lifetime of the Image. It somehow works with the panel in the example application you provided, but saving bitmap ultimately fails.
A code like
fails with the "Cannot access closed stream" exception.
Extension method BitmapExtension.ToBitmap is flawed. MSDN states that one must keep the stream open for the lifetime of the Image. It somehow works with the panel in the example application you provided, but saving bitmap ultimately fails.