Is the ReportProcessor.RenderReport function thread safe?

6 posts, 0 answers
  1. Nils
    Nils avatar
    3 posts
    Member since:
    Nov 2016

    Posted 13 Nov 2016 Link to this post

    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

  2. Nils
    Nils avatar
    3 posts
    Member since:
    Nov 2016

    Posted 13 Nov 2016 in reply to Nils Link to this post

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

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

  3. Alberto
    Alberto avatar
    2 posts
    Member since:
    May 2013

    Posted 21 Apr 2017 in reply to Nils Link to this post

    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

  4. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 21 Apr 2017 Link to this post

    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
  5. Shawn
    Shawn avatar
    54 posts
    Member since:
    Jul 2011

    Posted 26 Apr 2018 in reply to Stef Link to this post

    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.

  6. Peter
    Admin
    Peter avatar
    1651 posts

    Posted 01 May 2018 Link to this post

    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
Back to Top