Page 1 of 1

Should we call Dispose on StiReport

Posted: Fri May 06, 2011 10:05 pm
by jay@bplogix.com
When viewing a report on an ASPX page, I enclosed the new StiReport() in the Page_Load event in a C# "using block" to automatically dispose the object when the Page_Load completed. This caused the report not to be rendered.

Should we dispose or close the Report object at any point in the page lifecycle?

Should we call Dispose on StiReport

Posted: Tue May 10, 2011 1:35 am
by Alex K.
Hello,

If we have correctly understood your problem, it is not entirely correct to dispose a report in the Page_Load, since a report in the future may be necessary for the viewer.
Please send us sample project for analysis.

Thank you.

Should we call Dispose on StiReport

Posted: Tue May 10, 2011 1:31 pm
by jay@bplogix.com
Basically, I am just doing a

StiReport report = new StiReport();
report.Load("report.mrt");
StiWebViewer1.Report = report;

Should we ever call Dispose or close the StiReport object (report) that was created? Or does the StiWebViewer clean up automatically? None of your samples call Dispose or Close directly, so I think that the StiWebViewer control cleans up for us, right?

Thanks

Should we call Dispose on StiReport

Posted: Wed May 11, 2011 2:41 am
by Alex K.
Hello,

The .NET Garbage Collector does this and there is no obvious need to trace it. But if you want, you can call Dispose.

Thank you.

Should we call Dispose on StiReport

Posted: Wed May 11, 2011 12:34 pm
by jay@bplogix.com
The Garbage collector will clean up resources ... eventually. On a high-use server application there is no way to ensure that the garbage collection will be done in a timely manner. Are there resources/handles/etc that the report engine is opening that would need me to specifically call Dispose?

If so, where would I call Dispose? When I called it in Page_Load, the report did not load correctly.

thx

Should we call Dispose on StiReport

Posted: Thu May 12, 2011 1:15 am
by Alex K.
Hello,

Please send us sample project which reproduces the issue for analysis.

Thank you.

Should we call Dispose on StiReport

Posted: Thu May 12, 2011 1:38 pm
by jay@bplogix.com
On the WebViewerDemo.aspx.cs in your Stimulsoft Reports.Web 2011.1\Samples\C#\WebDemo folder,

Is it safe and advisable to change

// Load report
StiReport report = new StiReport();
report.Load(appDirectory + "\\Reports\\SimpleList.mrt");
report.RegData(dataSet);

// View report
StiWebViewer1.Report = report;


INTO THIS (notice the using which will Dispose the report object at the end of the block):

// Load report
using (StiReport report = new StiReport())
{
report.Load(appDirectory + "\\Reports\\SimpleList.mrt");
report.RegData(dataSet);

// View report
StiWebViewer1.Report = report;
}

Should we call Dispose on StiReport

Posted: Wed May 18, 2011 8:10 am
by Vladimir
Hello,

Yes, you can correct the code in this way. Functionality should not be broken.

Thank you.