I am using PdfSharp 1.32.3057.0 GDI+ in a  .Net service on Windows 2008 R2 to convert 1-6 page tiff files to pdf.  A few of the output pdf files get an "insufficient data for an image"  error in Adobe reader.   If I reconvert the same image then it will render with no problem.
I have reproduced the issue in test code that just loops converting the same file in my dev environment - I normally get 1-4% errors.   Any ideas what may be wrong?  A workaround or even a quick way of detecting a problem image would help.
Code:
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
namespace TestPdfConvert
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int loop = 1; loop <= 100; loop++)
            {
                System.Console.WriteLine(loop);
                ConvertImage();
            }
            System.Console.ReadLine();
        }
        private static void ConvertImage()
        {
            using (Image inputImage = Image.FromFile(@"D:\test\input\test.tif"))
            {
                using (PdfDocument doc = new PdfDocument())
                {
                    for(int frameNo =0; frameNo<inputImage.GetFrameCount(FrameDimension.Page); frameNo++)
                    {
                        inputImage.SelectActiveFrame(FrameDimension.Page,frameNo);
                        using (MemoryStream memoryStream = new MemoryStream())
                        {
                            inputImage.Save(memoryStream, ImageFormat.Bmp);
                            using (XImage outputImage = Image.FromStream(memoryStream))
                            {
                                PdfPage page = new PdfPage();
                                page.Width = outputImage.PointWidth;
                                page.Height = outputImage.PointHeight;
                                doc.AddPage(page);
                                using (XGraphics xgraphics = XGraphics.FromPdfPage(page))
                                {
                                    xgraphics.DrawImage(outputImage, 0, 0);
                                }
                            }
                        }
                    }
                    doc.Save( string.Format(@"D:\test\output\test_{0}.pdf",System.DateTime.Now.ToString("HH_mm_ss.fff")) );
                }
            }
        }
    }
}