The following code produces this exception and the stack trace (to the last method in the stack before my method calling RenderToFilter) in footnote [1]:
private Bitmap[] CreateTiffs(C1Report report) {MemoryStream ms = new MemoryStream();
TiffFilter filter = new TiffFilter(ms);
filter.Resolution = 210;
report.RenderToFilter(filter);
...
// create and populate myBitmapArray, create TIFFs, etc.
...
ms.Close();
ms.Dispose();
filter.Dispose();
return myBitmapArray;
}
The only thing I can determine is that this exception occurs only when the number of calls to RenderToFilter is fairly-large (I have looped this method to create TIFFs from a set of over 500 reports, without error). But the amount of data shouldn't matter...
Has anybody seen this before? Is this a bug (whether in .NET or in the C1Report class), and if so, is there a workaround?
[1]
System.Runtime.InteropServices.ExternalException was unhandled
Message="A generic error occurred in GDI+."
Source="System.Drawing"
ErrorCode=-2147467259
StackTrace:
at System.Drawing.Image.SaveAdd(Image image, EncoderParameters encoderParams)
at C1.Win.C1Report.TiffFilter.EndReport()
at C1.Win.C1Report.Layout.ab()
at C1.Win.C1Report.C1Report.x()
at C1.Win.C1Report.C1Report.ad(ExportFilter A_0, Boolean A_1)
at C1.Win.C1Report.C1Report.RenderToFilter(ExportFilter filter)