Error when loading report


03-02-2010, 4:53 AM
I load a report in the ReportPreview component on my form. When I close the form and reopen it again then I get an error message on the report. The information that I get from the error box is as follows:

DataDynamics.Reports.ReportsException: An unexpected error occured. Additional information: 'Object reference not set to an instance of an object.' ---> System.NullReferenceException: Object reference not set to an instance of an object.
at #R2e.#Ktb.#pAf(IReportItem reportItem)
at #R2e.#R3e.#fyf()
at #R2e.#R3e.#fyf(Single maxExtent, Single& minHeight, Single& estimatedHeight)
at #R2e.#O3e.#Juf(#N3e section, Single& fullHeight)
at #R2e.#O3e..ctor(TableGroup groupDefinition, #V3e masterLayoutManager, #M3e parent)
at #R2e.#xPi.CreateInstance(Int32 index)
at #xUe.#qYj.get_Item(Int32 index)
at #R2e.#xPi.#nyf()
at #R2e.#xPi..ctor(TableGroupCollection groups, #V3e masterLayoutManager, #O3e owner)
at #R2e.#O3e..ctor(Table tableDefinition, #V3e masterLayoutManager)
at #R2e.#P3e..ctor(Table tableDefinition, #V3e masterLayoutManager)
at #R2e.#W3e.Reset()
at #R2e.#W3e..ctor(Table tableDefinition, #V3e masterLayoutManager)
at #R2e.#V3e.#gh(LayoutContext layoutContext, #e4e spaceManager)
at #R2e.#l3e.#Rvf(LayoutContext context, #e4e spaceManager)
at #R2e.#83e.#Rvf(LayoutContext context, #e4e masterSpaceManager)
at #R2e.#93e.#gh(LayoutContext context, #e4e spaceManager)
at #R2e.#93e.#Xyf(LayoutContext context)
at #R2e.#93e.#Dxf()
at #R2e.#93e.BuildLayout()
at #R2e.#rX.BuildLayout(LayoutInfo layoutInfo)
at #SLf.#RLf.#NNf(IReport report, #9Lf targetDevice, LayoutNotificationCallback callback)
at DataDynamics.Reports.Rendering.Graphics.ImageRenderingExtension.Render(IReport report, StreamProvider streams, NameValueCollection settings)
at DataDynamics.Reports.ReportRuntime.Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, Boolean forceDataRefresh)
--- End of inner exception stack trace ---

Server stack trace:
at DataDynamics.Reports.ReportRuntime.Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, Boolean forceDataRefresh)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at #bPf.#aPf.#U.#ePf.EndInvoke(IAsyncResult result)
at #bPf.#aPf.#XSf(IAsyncResult result)

The odd thing is that the report renders completely and that nothing seems wrong with the data that is being displayed. So I am at a loss as of why this error is thrown and what it actually means, since nothing appears to be wrong with the report.

Re: Error when loading report


03-02-2010, 9:42 AM
Hello,
Could you please explain the scenario "
When I close the form and reopen it again..." in more details?
As I understand the form hosts Preview control. Once the form is loaded, preview control starts rendering the report. If you close the form during the rendering process then open the form again, the exception appears.
Is that correct? Or the scenario differs from what I described?


Sergey Abakumoff
GrapeCity

Re: Error when loading report


03-03-2010, 12:20 AM
I open the form and load the report in the preview control. I let if finish loading in the preview control completely. Then I close to form with the preview control on it. From the main program, that has been running all the time, I open the report again and then I get the error.
Like I said in my first post, I can't see what is actually going wrong as all data gets loaded in the report the way it is supposed to be loaded.

Re: Error when loading report


03-03-2010, 12:37 AM
Hello,
I tried to reproduce the problem and had no luck. It seems
(from the stack trace) that that the error appears with the particular reports only. Could you please send us rdlx file of the report with which the problem arises?

Sergey Abakumoff
GrapeCity

Re: Error when loading report


03-03-2010, 12:53 AM
The report that is generated is 75 pages in size. I don't know if that has anything to do with it though.

Re: Error when loading report


03-03-2010, 11:23 PM
Hello,
I tried to repeat the problem on my side. I changed the report you sent to use Northwind database and created the small application that repeats the scenario you described. I can't reproduce the problem though. I've attached the application. Could you modify it so that the issue can be observed on our side. The steps I used to repeat the problem:
1. Run the application.
2. Click "open preview" button.
3. Preview form appears, wait until the report rendering is completed.
4. Close the preview form.
5. Click "open preview" button again.


Sergey Abakumoff
GrapeCity

Re: Error when loading report


03-04-2010, 1:39 AM
I am having troubles opening the procject. There are two references in the project that I don't have on my machine:
-DataDynamics.Reports.Windows.Forms.2008
-nunit.framework

So I can't run the application. I am currently using DataDynamics Reports version 1.6.1362

Re: Error when loading report


03-04-2010, 1:48 AM
Sorry for that! You can remove nunit.framework and DataDynamics.Reports.Windows.Forms.2008 references and add the reference to DataDynamics.Reports.Windows.Forms assembly that is installed in the GAC on your machine.

Sergey Abakumoff
GrapeCity

Re: Error when loading report


03-04-2010, 3:22 AM
I tried to load my report in your test application and it worked there with no problem at all, so I went back to my own application to search deeper in the code.
Now I found that during the loading of my form an event is fired multiple times in which the report gets reloaded. So the command to load the report definition is executed 5 times in short succession and that causes the error.
I will look to solve the issue of the event firing during the loading of the report now.

Thanks for the help on this matter.

EDIT:
Putting in the line:
this.reportPreview1.OpenReport(runtime, "Hello world");
in the sample project reproduced the error without flaw.

Re: Error when loading report


03-07-2010, 11:01 PM
 dvanmil wrote:
EDIT: Putting in the line: this.reportPreview1.OpenReport(runtime, "Hello world"); in the sample project reproduced the error without flaw.

Hello,
Sorry, It's not clear how the sample project should be modified to reproduce the error, could you please send us the modified code?

Sergey Abakumoff
GrapeCity

Re: Error when loading report


03-08-2010, 12:55 AM
private void PreviewForm_Load(object sender, EventArgs e)
{
var def = new ReportDefinition(new FileInfo(@"..\..\ErrorLoadingReport.rdlx"));
var runtime = new ReportRuntime(def);
this.reportPreview1.OpenReport(runtime, "Hello world");
this.reportPreview1.OpenReport(runtime, "Hello world");
this.reportPreview1.OpenReport(runtime, "Hello world");
this.reportPreview1.OpenReport(runtime, "Hello world");
this.reportPreview1.OpenReport(runtime, "Hello world");
}

This is the code that will produce the error. The OpenReport command is executed multiple times in short succession which will cause the error to be thrown.

Re: Error when loading report


03-08-2010, 9:47 PM
Hello,
Thanks for the information.
I've added change request 143861 to handle the scenario when the OpenReport command is executed multiple times in short succession. It should not be allowed to open the report while another one is rendered by viewer.
 

Sergey Abakumoff
GrapeCity