Reporting Service Invalid Image Data Error

2 posts, 0 answers
  1. Colin Cowie
    Colin Cowie avatar
    10 posts
    Member since:
    May 2010

    Posted 25 Sep 2012 Link to this post

    Hi, we use the wcf service to render reports to pdf for emailing within our application, as well as the silverlight report viewer for viewing them on screen.  If an image within a report is invalid somehow (we occasionally have zero byte image files generated by another part of our application), then within the silverlight app report viewer it shows in the picture box as being invalid. 

    However, when using the wcf service the error gets propogated all the way back into the results of the render operation, in the Errors array, and in the HasErrors boolean.  I check the HasErrors boolean, and the content of the Errors array to report rendering failures, and do not email the resulting rendered document if any errors exist.

    This isn't really an error from the point of view of not emailing the report as far as we are concerned.  Is there any way to reliably discriminate between fatal errors (whatever they might be), and other minor errors like this?  If the report has rendered at all we would still want to email it, although we could still report on minor errors in our logging.  Could I check on the DocumentBytes property and see if that's non-null and has a size of greater than zero?

    Alternateively is there some way to get the picturebox to completely suppress the error and not throw its own exception under this particular circumstance?

    Thanks,

    Colin.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Sep 2012 Link to this post

    Hello Colin,

    The correct solution would be to ensure that there are no exceptions raised as a whole. The error message in red rectangle instead of the faulty report item is meant only for the developer to see while working on the report and not meant for the end user to see.

    Anyway you can work around/suppress the error by using the Error event of the report. The sender element of the error event handler is the report item which has error and thus the following code would cover it up:

    private void Report1_Error(object sender, ErrorEventArgs eventArgs)
    {
       Telerik.Reporting.Processing.ProcessingElement procEl = (Telerik.Reporting.Processing.ProcessingElement)sender;
       procEl.Exception = null;
    }

    Hope this helps!

    Regards,
    Steve
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

  3. DevCraft banner
Back to Top