Error: A generic error occurred in GDI+.

Stimulsoft Reports.NET discussion
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Error: A generic error occurred in GDI+.

Post by Alex K. »

Hello,
Rendrering of report produces "Out of memory exception" In new project.
Please try to set the ReportCacheMode property to the "On" for the report.

Thank you.
Attachments
Capture.PNG
Capture.PNG (131.83 KiB) Viewed 2511 times
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

It's magic - it works! Thank You, Aleksey!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Error: A generic error occurred in GDI+.

Post by Alex K. »

Hello,

We are always glad to help you!

Thank you.
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

I found one more issue in this thing. If we will have enough data in report, it crashes during export into PDF or XLS format. Do you have some magic for this situation?
PS: at this time we're using Stimulsoft version 2015.1
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

I have some updates on this situation

1. I'm receiving this problem when I'm running report from my program. Exception occuring on line:
reportCtrl.ExportDocument(StiExportFormat.Pdf, SaveAs);
where reportCtrl is instance of StiReport. This object was used for report processing. This instruction was executed previously:
reportCtrl.Render();

2. If I'm opening template inside my program and showing it with reportCtrl.Show(); -> I can run my report without any problems. When I'm trying to save rendered report into PDF file from StimulSoft designer -> I'm getting exception 'Out of memory'

3. If I'm opening Stimulsoft Designer in standalone mode (not inside my app), I don't have any problems with saving rendered report with same data!

Stack trace obtained in 2nd option:
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at Stimulsoft.Base.Drawing.StiImageConverter.BytesToImage(Byte[] bytes)
at Stimulsoft.Base.Drawing.StiImageConverter.StringToImage(String str)
at Stimulsoft.Report.StiReportObjectStringConverter.StringToObject2(String str, Type type)
at Stimulsoft.Report.StiReportObjectStringConverter.StringToObject(String str, Type type)
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props)
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props)
at Stimulsoft.Base.Serializing.StiSerializing.Deserialize(Object obj, Stream stream, String application)
at Stimulsoft.Report.Components.StiPagesCollection.DeserializePage(Stream stream, StiSerializing sr, StiPage page)
at Stimulsoft.Report.Components.StiPagesCollection.LoadPage(StiPage page)
at Stimulsoft.Report.Components.StiPagesCollection.GetPage(StiPage page)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf1(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, StiExportService exportService, Stream stream, StiExportSettings settings)
at Stimulsoft.Report.Export.StiExportService.DoExport(StiExportInfo info)
at Stimulsoft.Report.Export.StiExportService.StartExport(StiReport report, Stream stream, StiExportSettings settings, Boolean sendEMail, Boolean openAfterExport, String fileName, StiGuiMode guiMode)
at Stimulsoft.Report.Export.StiPdfExportService.form_Complete(IStiFormRunner form, StiShowDialogCompleteEvetArgs e)
at Stimulsoft.Base.StiWinFormRunner.InvokeComplete(Boolean dialogResult)
at Stimulsoft.Base.StiWinFormRunner.ShowDialog()
at Stimulsoft.Report.Export.StiPdfExportService.Export(StiReport report, String fileName, Boolean sendEMail, StiGuiMode guiMode)
at Stimulsoft.Report.Viewer.StiViewerControl.OnProcessExport(Object sender)
at Stimulsoft.Report.Viewer.StiViewerControl.InvokeProcessExport(StiExportService service)
at Stimulsoft.Report.Viewer.StiViewerControl.cmExport_Click(Object sender, EventArgs e)
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Error: A generic error occurred in GDI+.

Post by Lech Kulikowski »

Hello,

Could you send us a sample which reproduces the issue for analysis?

Thank you.
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

Ok, Lech, thank you for your support. I found solution by myself

For guys that will be trying to find solution for the same situation. You should add this code before rendering report from template:

reportCtrl.ReportCacheMode = StiReportCacheMode.On;
StiOptions.Engine.ReportCache.AmountOfProcessedPagesForStartGCCollect = 2; // default - 20
StiOptions.Engine.ReportCache.AmountOfQuickAccessPages = 5; // default - 50
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Error: A generic error occurred in GDI+.

Post by Lech Kulikowski »

Hello,

Thank you for the provided solution.
Post Reply