Hello,
I run into the following .Net exception that seems to be triggered from the Telerik Reporting engine: "Unhandled exception, filepath [Telerik.ReportViewer.axd]System.InvalidOperationException: Invalid image data. ---> System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+." Maybe someone has seen this before? Looks a bit related to this problem.
The problem seems specifically to occur when I render a textbox control that is rotated for 90 degrees, so with vertical text rendering. Also the problem only occurs during HTML rendering, for example PDF rendering is no problem. It seems that vertical text in html gets rendered as an image. The GDI+ exception occurs when this textbox is rendered. It also seems to be related to bigger data amounts, having reports with at least 50 pages.
Googling for a solution it seems that this exception often occurs:
- Because of a rights issue when output is written to a file directory. This does not seem to be likely since I choose to render entirely in memory.
- The generated bitmap is not properly disposed. This would be something in the Telerik rendering engine and is out of my control.
Some more background:
In our app we do generate the report layout programmatically and I have not been able to reproduce this problem using a report generated with the report builder. I also logged a support ticket for this issue but the response was "please send a sample project." Unfortunately I was not able to reproduce the problem in a sample project. I'll keep you posted when I get a solution from Telerik though.
Stack trace:
[5232] 24-4-2012 12:10:02 [12:10:02] Unhandled exception, filepath [/Florin/Telerik.ReportViewer.axd]System.InvalidOperationException: Invalid image data. ---> System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at Telerik.Reporting.Processing.Imaging.ImageUtils.SaveBitmap(Stream stream, Image image)
at Telerik.Reporting.Processing.Imaging.ImageUtils.ResolveImage(Image image)
at Telerik.Reporting.Processing.Imaging.ImageUtils.GetImageData(Object value)
--- End of inner exception stack trace ---
at Telerik.Reporting.Processing.Imaging.ImageUtils.GetImageData(Object value)
at Telerik.Reporting.Processing.Imaging.ImageContainer..ctor(Object value)
at Telerik.Reporting.HtmlRendering2.Common.Writers.ImageWriter.SaveImageInStream(Image image)
at Telerik.Reporting.HtmlRendering2.Common.Writers.RotatedTextElement.WriteImage(Image image, Single imageWidth, Single imageHeight, Single left, Single top)
at Telerik.Reporting.HtmlRendering2.Common.Writers.RotatedTextElement.WriteElement(ProcessingElement element, RectangleF writeTextRectangle, RectangleF imageRectangle)
at Telerik.Reporting.HtmlRendering2.Common.Writers.RotatedTextElement.End(ProcessingElement element, ElementPageInfo pageInfo)
at Telerik.Reporting.Paging.PageElementLayer.AddToPage(IPageHandler handler)
at Telerik.Reporting.Paging.PageElementManager.AddToPage(IPageHandler handler)
at Telerik.Reporting.Paging.PageCompositionBase.SendPhysicalPages(Boolean lastPage)
at Telerik.Reporting.Paging.InteractiveLayout.PageComposition.PageOverride()
at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 reports, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.ReportViewer.WebForms.ReportPageOperation.RenderReport(String format, IList`1 processingReports, Hashtable deviceInfo, Hashtable renderingContext)
at Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride()
at Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)