This is a migrated thread and some comments may be shown as answers.

Is the ReportProcessor.RenderReport function thread safe?

5 Answers 181 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nils
Top achievements
Rank 1
Nils asked on 13 Nov 2016, 08:43 PM

Hi Guys,

 

As per the title is that funciton thread save? When I'm calling this in a multi threaded app I get an exception on the rendering although all variables are declared locally. So my guess would be that it is not?

Stack Trace JIC:

------------------------------------------------------------------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Telerik.Reporting.Processing.Common.FontContainer.GetFontDef(String fontName, FontStyle fontStyle)
   at Telerik.Reporting.Processing.Common.FontContainer.FillBuffer(Font gdiFont, Byte[]& buffer)
   at Telerik.Reporting.Pdf.Fonts.TrueType.FontReader.GetFontData(Font font, Boolean& isTTC)
   at Telerik.Reporting.Pdf.Fonts.TrueType.TrueTypeDescriptor..ctor(Font gdiFont)
Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Telerik.Reporting.Processing.Common.FontContainer.GetFontDef(String fontName, FontStyle fontStyle)
   at Telerik.Reporting.Processing.Common.FontContainer.FillBuffer(Font gdiFont, Byte[]& buffer)
   at Telerik.Reporting.Pdf.Fonts.TrueType.FontReader.GetFontData(Font font, Boolean& isTTC)
   at Telerik.Reporting.Pdf.Fonts.TrueType.TrueTypeDescriptor..ctor(Font gdiFont)
An error has occurred while rendering the report: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Telerik.Reporting.Processing.Common.FontContainer.GetFontDef(String fontName, FontStyle fontStyle)
   at Telerik.Reporting.Processing.Common.FontContainer.FillBuffer(Font gdiFont, Byte[]& buffer)
   at Telerik.Reporting.Pdf.Fonts.TrueType.FontReader.GetFontData(Font font, Boolean& isTTC)
   at Telerik.Reporting.Pdf.Fonts.TrueType.TrueTypeDescriptor..ctor(Font gdiFont)
   at Telerik.Reporting.Pdf.PdfFontTable.GetDescriptor(PdfFont font)
   at Telerik.Reporting.Pdf.PdfFontDictionary..ctor(PdfDocument document, PdfFont drawingFont)
   at Telerik.Reporting.Pdf.PdfFontType0Dictionary..ctor(PdfDocument document, PdfFont font)
   at Telerik.Reporting.Pdf.PdfFontTable.GetFont(PdfFont font)
   at Telerik.Reporting.Pdf.PdfPageDictionary.GetFontName(PdfFont font, PdfFontDictionary& fontDictionary)
   at Telerik.Reporting.Pdf.Rendering.PdfRendererGraphicsState.Update(PdfFont font, Brush brush, Int32 renderMode)
   at Telerik.Reporting.Pdf.Rendering.PdfRenderer.Update(PdfFont pdfFont, Brush brush, Int32 renderMode)
   at Telerik.Reporting.Pdf.Rendering.PdfRenderer.DrawString(String text, PdfFont pdfFont, Brush brush, RectangleF rect, Boolean rightToLeft)
   at Telerik.Reporting.ImageRendering.CanvasPdf.DrawRegularChunk(String text, Font font, Brush brush, RectangleF rect, TextFormat textFormat)
   at Telerik.Reporting.ImageRendering.CanvasBase.DrawStringMultiline(String s, Font font, Brush brush, RectangleF rect, TextFormat format, Boolean isFinalTextChunk)
   at Telerik.Reporting.ImageRendering.DocumentBase.WriteText(String text, RectangleF bounds, IFont font, Color foreground, TextFormat format, Matrix transform, Boolean isFinalTextChunk)
   at Telerik.Reporting.Writing.TextBoxWriter.WriteContent(DocumentWriter writer, TextBox textBox, ElementPageInfo pageInfo)
   at Telerik.Reporting.Writing.ProcessingContentElementWriter`1.WriteContent(T element, ElementPageInfo pageInfo, DocumentWriter writer)
   at Telerik.Reporting.Writing.ProcessingElementWriter`1.Write(T element, ElementPageInfo pageInfo, DocumentWriter writer)
   at Telerik.Reporting.Writing.ElementWriter`1.Telerik.Reporting.Writing.IElementWriter.StartWrite(LayoutElement element, ElementPageInfo pageInfo, DocumentWriter writer)
   at Telerik.Reporting.Writing.WriteStartOperationsDispatcher.Write(IElementWriter writer, LayoutElement element, ElementPageInfo pageInfo, DocumentWriter documentWriter)
   at Telerik.Reporting.Writing.WriteOperationsDispatcher.Visit(TextBox textBox)
   at Telerik.Reporting.Processing.TextBox.Accept(ProcessingElementVisitor visitor)
   at Telerik.Reporting.Processing.ProcessingElementVisitor.Visit(LayoutElement element)
   at Telerik.Reporting.Writing.DocumentWriter.Telerik.Reporting.BaseRendering.IWriter.WriteStartElement(LayoutElement element, ElementPageInfo pageInfo)
   at Telerik.Reporting.BaseRendering.PageHandler.Telerik.Reporting.Paging.IPageHandler.StartElement(LayoutElement element, ElementPageInfo info)
   at Telerik.Reporting.Paging.PageStartElement.AddToPage(IPageHandler handler)
   at Telerik.Reporting.Paging.PageElementLayer.AddToPage(IPageHandler handler)
   at Telerik.Reporting.Paging.PageElementManager.AddToPage(IPageHandler handler)
   at Telerik.Reporting.Paging.PageCompositionBase.AddElementsToPage()
   at Telerik.Reporting.Paging.PageCompositionBase.SendPhysicalPages()
   at Telerik.Reporting.Paging.PageCompositionBase.OutputPage()
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages()
   at Telerik.Reporting.Paging.PagerBase.Telerik.Reporting.Paging.IPager.CreatePages(IPageHandler handler, LayoutElement root)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings)
Exception thrown: 'System.NullReferenceException' in Telerik.Reporting.dll

------------------------------------------------------------------------------------------------------------

 

Cheers

Nils

5 Answers, 1 is accepted

Sort by
0
Nils
Top achievements
Rank 1
answered on 13 Nov 2016, 08:47 PM

I can resolve this issue by locking the render report function like this

SyncLock lock
  RenderReport("PDF", inst, deviceInfo)
End SyncLock

0
Alberto
Top achievements
Rank 1
answered on 21 Apr 2017, 09:17 AM

Hello Nills,

Did you solve the issue implmenting locking, ┬┐do you have more info?

 

I'm facing the same problem on a website randonmly a simila exception is thrown.

 

It's a pitty that telerik didn't reply to thisquestion

0
Stef
Telerik team
answered on 21 Apr 2017, 02:48 PM
Hi everyone,

This is a known issue in the Rendering, we apologize for.
A fix is provided in Telerik Reporting R1 2017 SP2 v11.0.17.406 - Installing Telerik Reporting.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shawn
Top achievements
Rank 2
answered on 26 Apr 2018, 08:58 AM

I am using v2018 R1, and am still running into this multi-threading problem.

My scenario is using async/await handlers for NServiceBus messages.  When multiple messages process different reports at the same time, I hit this error.

I work around the problem by using the lock() statement workaround referred to above...which kind of negates the whole async/await benefit.

0
Peter
Telerik team
answered on 01 May 2018, 07:54 AM
Hello Shawn,

This is a known issue that we have fixed in the latest SP. For more information check out the release notes for R1 2018 SP3.

Regards,
Peter
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Nils
Top achievements
Rank 1
Answers by
Nils
Top achievements
Rank 1
Alberto
Top achievements
Rank 1
Stef
Telerik team
Shawn
Top achievements
Rank 2
Peter
Telerik team
Share this question
or