Appending fails with Prepare(true)

edited May 2010 in FastReport .NET
Hello,

I get a NullReference-Exception when doing this on data where I registered a new DataSource (Business objects):

System.NullReferenceException occurred
Message=Object reference not set to an instance of an object.
Source=FastReport
StackTrace:
at V6yBF5sXi3XJCX5u3nE.pEYsTesPk6Fe67R9J26.pihdHGqtY()
at FastReport.Preview.PreparedPages.AddPage(ReportPage page)
at FastReport.Engine.ReportEngine.qyyjvRmLve()
at FastReport.Engine.ReportEngine.v7yj2g8AO1(ReportPage )
at FastReport.Engine.ReportEngine.wxDj6dlvUW()
at FastReport.Engine.ReportEngine.dEHd5mA4V(ReportPage )
at FastReport.Engine.ReportEngine.kI5xKeqvb(Boolean , Boolean , ReportPage )
at FastReport.Report.Prepare(Boolean append)
(v.1.4.3.0)

when I use 1.3.70 then it fails even earlier since the dynamically created .cs file (validated with report.GenerateReportAssembly(filename)) contains errors.

The problem starts when I have different data sources.
Currently I'm doing something like this:
while (loop){
  report.Dictionary.ClearRegisteredData();
  report.Load(some source);
  report.RegisterData(data /* derives from IEnumerable<T>*/, "NAME" /*always the same*/);
  report.Prepare(true);
}

This works for many reports as long as "data" is of the very same type. But with different business objects, it fails.
Is there something I can call for a complete rebuild of internal dictionaries? (Neither report.Refresh() nor report.Dictionary.ClearRegisteredData() does help.)

Comments

  • edited 5:06PM
    Hello,

    The first call to Prepare() must be with append=false. I have tried to reproduce the bug, but it works well for my reports. Could you prepare a demo project for me?
  • edited 5:06PM
    AlexTZ wrote: »
    The first call to Prepare() must be with append=false.

    This does not change anything for me. Even appending several reports with Prepare(true) works as long as all data source objects are the same (maybe you already know if the report is prepared at all or not -- maybe by checking PreparedPages against null).

    I'll try to extract a sample -- my hope was that the callstack would point you to the source of the NullReferenceException.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.