Should we call Dispose on StiReport
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Should we call Dispose on StiReport
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 dispose or close the Report object at any point in the page lifecycle?
Should we call Dispose on StiReport
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.
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.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Should we call Dispose on StiReport
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
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
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.
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.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Should we call Dispose on StiReport
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
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
Hello,
Please send us sample project which reproduces the issue for analysis.
Thank you.
Please send us sample project which reproduces the issue for analysis.
Thank you.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Should we call Dispose on StiReport
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;
}
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
Hello,
Yes, you can correct the code in this way. Functionality should not be broken.
Thank you.
Yes, you can correct the code in this way. Functionality should not be broken.
Thank you.