Hello DevExpress Team,
In our application report DataSource is assigned in the Report.DataSourceDemanded script. I noticed that objects assigned as a DataSource are not being GC'ed at all. I tried use memory profiler to determine the cause of the issue, but the only conclusion I have derived is that these objects are holding by the ScriptingReport instance which is not GC'ed too. I prepared a sample project demonstating this issue in action. There are two equivalent reports in the project: CodeBehindReport and ScriptReport. The only difference between them is the way the Report.DataSource property is initialized. In the first one it's initialized in code-behind, in the second one - in script. Below you'll find steps to reproduce the issue:
- Open and lauch attached project
- Click the "Build simple report" button - "Leaked 0 Person instances" message box has to be shown. It indicates that all two Person instances has been GC'ed.
- Click the "Build script report" button - "Leaked 2 Person instances" message box has to be shown.
Is there any fix/workaround for this issue (except of not assigning DataSource from scripts)?
Wish you have a great day,
Khindikaynen Aleksey
Hello Aleksey,
Thank you for pointing out this issue and providing us with detailed research results.
I was able to reproduce this behavior on our side and forwarded this thread to our R&D team for further research. As a temporary workaround to this issue, wrap the creation of the ScriptReport into the 'using' statement:
new Action(() => { using (var report = new ScriptReport()) { report.CreateDocument(false); } })();
Thanks,
Dmitry