none
RDLC 2008 (VS2010) PDF rendering error and inconsistency RRS feed

  • Question

  • I've recently converted by VS2008 project to VS2010 (and hence RDLC 2005 to 2008) and changed the project reference from report viewer 9.0 to 10.0, however when trying to render the report, (PDF format) strange thing happened where error "An error occurred during local report processing." occurs with some of the datarows.

    The exception read as follow:

    Microsoft.Reporting.WinForms.LocalProcessingException was unhandled
      Message=An error occurred during local report processing.
      Source=Microsoft.ReportViewer.WinForms
      StackTrace:
           at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
           at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
           at Microsoft.Reporting.WinForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
           at Microsoft.Reporting.WinForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
           at JAC.FormJobListing.GenerateDO() in C:\Vbin\Project\Inventory\Job\JobListing.vb:line 1649
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.IO.EndOfStreamException
           Message=Unable to read beyond the end of the stream.
           Source=mscorlib
           StackTrace:
                at System.IO.__Error.EndOfFile()
                at System.IO.BinaryReader.ReadString()
                at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(BinaryReader reader, String& value, TypeCode& typeCode, Object& originalValue)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(PageContext pageContext, String& value, TypeCode& typeCode, Object& originalValue)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetOriginalValue(PageContext pageContext)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.RegisterTextBoxes(RPLWriter rplWriter, PageContext pageContext)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 page, Int32 totalPages)
                at Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport)
                at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
                at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)
           InnerException:

    I've design the application in such a way that each row of data generates 1 report and thing become strange that not all data generates this exception, exception only be thrown from a few rows of data. The same project work nicely with VS2008 (RDLC2005), what's wrong with VS2010 and RDLC 2008?

    Below is portion of my code in VB:

    LoadReportData(DS)
    Dim ReportBindingSource As New System.Windows.Forms.BindingSource(DS, "JAC")
    Dim ReportDS As New Microsoft.Reporting.WinForms.ReportDataSource("JAC_Dataset", ReportBindingSource)
    Dim ReportGenerator As New Microsoft.Reporting.WinForms.ReportViewer
    ReportGenerator.LocalReport.DataSources.Add(ReportDS)
    ReportGenerator.LocalReport.ReportEmbeddedResource = "JAC.rdlc"

    Dim RemarkParam(0) As ReportParameter

    'Forced to insert this row. Null value report parameter seems not acceptable to VS2010 anymore
    If ParameterDocRemarks.Trim = "" Then ParameterDocRemarks = "- None -"

    RemarkParam(0) = New ReportParameter("Remarks", ParameterDocRemarks, True)
    ReportGenerator.LocalReport.SetParameters(RemarkParam)
    ReportGenerator.RefreshReport()


    Dim warnings As Warning() = Nothing
    Dim streamids As String() = Nothing
    Dim mimeType As String = Nothing
    Dim encoding As String = Nothing
    Dim extension As String = Nothing
    Dim bytes As Byte()

    Try

         bytes = ReportGenerator.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)

    Catch ex As Exception
         MessageBox.Show(ex.Message)
    End Try

    Does anyone face the same or having any clue of what happening there?

    Many thanks

    VB

    Tuesday, November 2, 2010 7:18 AM

All replies

  • Have the same issue as reported by vbvun above..... did you (or anyone) face this issue or solve this issue?

     

    Of 3 reports in my website, only 1 fails with this error. The other 2 are fine and 1 of those uses sub-reports too!

    The report that fails is the most simple- and still runs fine on my vs2008 dev. browser without any changes... Guess the clue could be in the .NET version- now I am targeting for .NET4 whereas previously I targeted .NET2. But If NET4 can handle some of my reports, then likely the problem is elsewhere....

    Maybe the vs2010 report control handles certain values from the data source differently..... I wonder if there is a concise list of changes somewhere?

     

    Or maybe (as this report has NO sub report- I need to specify that somehow rather than leaving the default which might be null).  So much speculation!

     

    Exception:
    Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
      at System.IO.BinaryReader.ReadString()
      at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(BinaryReader reader, String& value, TypeCode& typeCode, Object& originalValue)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(PageContext pageContext, String& value, TypeCode& typeCode, Object& originalValue)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetOriginalValue(PageContext pageContext)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.RegisterTextBoxes(RPLWriter rplWriter, PageContext pageContext)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 page, Int32 totalPages)
      at Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport)
      at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
      at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)
      --- End of inner exception stack trace ---
      at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
      at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
      at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
      at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
      at ASP.report_aspx.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\xxxxxxxxxxx\report.aspx:line 355

     

     

    Tuesday, January 4, 2011 10:03 PM
  • ... something interesting:

     

    1. If I open the rdlc with webforms.reportviewer, it works fine and I can export to excel or word no problems- export to pdf still fails with above error.

     

    2. If I change the localreport.render to EXCEL instead of PDF, then it works ok even from code (ie. without using the reportviewer).

     

    So it seems the "export to pdf" is broken with certain .rdlc reports with vs2010 / net4.

     

    A step forward, but still no solution - all ideas welcome with great thanks!

    Wednesday, January 5, 2011 9:28 AM
  • Hi vbvun, did you get a solution to this

     

    I have the same problem but in my case, if I run the report through reportviewer, it works fine and I also could render to PDF using the export option. When I try to render directly to PDF gives me an error.

     

    Regards and tks

    Sunday, May 29, 2011 11:15 AM
  • The problem occurs in VC2010 express edition only and not in VS2010 professional edition. i have created a console application to generate a PDF in VS2010 professional it works fine. This is a code i have used.

    using 

    System;
     

     using System.Collections.Generic;

     using System.Linq;

    using System.Text;

     using System.Data.SqlClient;

     using System.Configuration;

     using Microsoft.Reporting.WinForms;

     using System.IO;

     using System.Data;

     namespace ConsoleApplication1 {

     

    static void Main(string  [] args) { 

    //Specify the RDLC path

     

     

    string reportPath = "ConsoleApplication1.Report1.rdlc" ;

    ReportDataSource sReportDataSource = null

    SqlConnection con = null

    SqlDataAdapter adapt = null

    DataSet ds = null

    LocalReport reportViewer = null

     

    {

    con =

    new SqlConnection(ConfigurationSettings.AppSettings["Sistema"

    ds =new DataSet 

    (); adapt.Fill(ds);

    ds.Tables[0].TableName ="RProfile" 

    ;

    reportViewer =new LocalReport

    ();

    reportViewer.ReportEmbeddedResource = reportPath;

    sReportDataSource =new ReportDataSource 

    ();

    sReportDataSource.Name ="DataSet1" 

    ;

    sReportDataSource.Value = ds.Tables[0];

    reportViewer.DataSources.Add(sReportDataSource);

    reportViewer.Refresh();

    Export(reportViewer);

    }

    catch (Exception ex) {.WriteLine(ex.Message);

    {

    {

    con.Close();

    }

    }

    }

     

      

    ///  

    /// Export RDLC into PDF format

     

     

    </summary>

    ///  

    /// <param name="reportViewer">LocalReport reportViewer

    static void Export(LocalReport

     

    string encoding;

    string  

    extension;

    string

    deviceInfo =

     

     

     

    "<DeviceInfo>"

     

    " <OutputFormat>PDF</OutputFormat>"

     

    " <PageWidth>8.5in</PageWidth>"

     

    " <PageHeight>10.5in</PageHeight>"

     

    " <MarginTop>0.05in</MarginTop>"

     

    " <MarginLeft>0.05in</MarginLeft>"

     

    " <MarginRight>0.05in</MarginRight>"

     

    " <MarginBottom>0.05in</MarginBottom>"

     

    "</DeviceInfo>"

     

    string

     

    Warning[] warnings;

     

    byte[] bytes = reportViewer.Render("PDF"

     

    string filepath = "F:\\MyFile.pdf";

     

     

     

     

    FileStream fs = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare

     

    int

     

     

    System.Diagnostics.

    Process

     

    .Start(filepath);

     

    }

     

    }

    }

     

    //Generate a PDF file in the above specified location

    )bytes.Length);

     

    fs.Close();

     

    .Read);

    fs.Write(bytes, 0, (

     

     

    //Create a PDF file in the above specified location

     

    //Location and the file name to be created as PDF.

    , deviceInfo);

     

     

    [] streamids;

    Microsoft.Reporting.WinForms.

     

    ;

     

     

    +

     

     

    +

     

     

    +

     

     

    +

     

     

    +

     

     

    +

     

     

    +

     

     

    +

     

     

    mimeType; 

    string  

    //Page settings for PDF File.

    reportViewer)

    </param>

    <summary>

    finally

     if (con != null 

    )

    Console 

    }

     

    ]);

    con.Open();

    adapt =new SqlDataAdapter("Select nRecordID,nTname,nLogo1,nClient,nName,nPosition,nCompany,nPhone,nEmail from RProfile", con);

    try

    ;

     

    ;

     

    ;

     

    ;

     

    ;

     

    class  Program{

    Wednesday, June 29, 2011 11:13 AM
  • It does happen in Visual Studio 2010 Professional.  I have a report that exports to Excel, but gets the error when exporting to PDf.  It has subreports, but in the same solution I have 2 other reports with similar code that do not get the error.  They all use the same data source and pull data from the same view.  I haven't figured out a solution other than printing to PDF at this point.  I had no choice as the report is due today, but I've been struggling to figure out the error for 2 days now.
    Friday, September 23, 2011 5:46 PM
  • Hi All,

    I came across the issue 'Unable to download' 'Unable to open this internet site...' when I was trying to EXPORT the RDLC report data (on report viewer) to PDF.

    If any one has the solution, please post it.

    Thanks in advance.

    Uday

    Wednesday, November 9, 2011 7:52 AM
  • Can you provide a simple RDLC that reproduces this error? Also do you have the VS 2010 Service Pack 1 installed, there were some fixes to the renderers that may address this issue. Thanks!

    Matt M.
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights

    Wednesday, November 9, 2011 5:33 PM
  • h

    i i have a similar problem with some of my reports it seems that for some items it doesnt like uint32 with me so i went to the dataset and changed it to int32 and voila worked like a charm!!!!!

    • Proposed as answer by Waseemooov Tuesday, January 10, 2012 6:45 PM
    Tuesday, January 10, 2012 5:56 PM
  • I´m able to reproduce a similar error using "Walkthrough: Printing a Local Report without Preview" doing the following:

    visual studio 2010 sp1

    - Create 2 datasets. DataSet1 and DataSet2

    - first dataset will have at least one column with uint64 datatype

    - create a blank report and add footer and header

    - add the two datasets to the report

    - create a tablix referencing dataset1 and containing the uint64 column

    - add at least one value to footer or header from DataSet2

    - modify the sample to use DataSet1 and DataSet2 datatables instead:

            report.DataSources.Add(new ReportDataSource("DataSet1", LoadData()));
                report.DataSources.Add(new ReportDataSource("DataSet2", LoadData1()));

    where LoadData will return the datatable with at least one row and a non-null value on the uin64 field

    private DataTable LoadData1()
    {
             ConsoleApplication4.DataSet2 ds = new ConsoleApplication4.DataSet2();
             return ds.DataTable1;
    }

    private DataTable LoadData()
    {
                    ConsoleApplication4.DataSet1 ds = new ConsoleApplication4.DataSet1();
                    DataRow row = ds.DataTable1.NewRow();
                    row[0] = 100; //seems to work fine if the number is less than 10
                    ds.DataTable1.Rows.Add(row);
                    return ds.DataTable1;

    }


    ERRORS

    Microsoft.Reporting.WinForms.LocalProcessingException

    {"An error occurred during local report processing."}
    InnerException
    {"Unable to read beyond the end of the stream."}

    StackTrace

       at System.IO.BinaryReader.ReadByte()
       at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(BinaryReader reader, String& value, TypeCode& typeCode, Object& originalValue)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.ReadNonSharedValuesFromCache(PageContext pageContext, String& value, TypeCode& typeCode, Object& originalValue)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetOriginalValue(PageContext pageContext)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.RegisterTextBoxes(RPLWriter rplWriter, PageContext pageContext)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 page, Int32 totalPages)
       at Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport)
       at Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
       at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)
    Thursday, March 15, 2012 11:43 AM
  • Waseemooov, you are a genius!!! My hat goes off to you! I replaced all UInt32 with Int64 in my dataset and it handled it. Thanks a lot!

    BTW, I too had the problem in VS2010 Professional.


    JF


    • Edited by Theta Saturday, March 17, 2012 1:22 AM
    Saturday, March 17, 2012 1:21 AM