I've web application and using AspNetCore 2.0. I'm using Telerik Reporting v12.0.18.125
I'm facing a memory leak issue in my system. After displaying the Report using Report Viewer the Report object is still in the memory heap and refreshing the report one time create more 3 report instances and it is never removed from the memory.
I'm using below CustomReportResolver to Resolve the report using DependencyInjection
public
class
CustomReportResolver : IReportResolver
{
private
readonly
IIocResolver iocResolver;
private
readonly
IAbpSession abpSession;
public
CustomReportResolver(IIocResolver iocResolver,IAbpSession abpSession)
{
this
.iocResolver = iocResolver;
this
.abpSession = abpSession;
}
public
ReportSource Resolve(
string
reportId)
{
var reportType = Type.GetType(reportId);
if
(reportType ==
null
)
throw
new
UserFriendlyException($
"Could not find a corresponding report for type '{reportId}'."
);
var report = (Report)
this
.iocResolver.Resolve(reportType);
var customReport = report
as
ReportBase;
if
(customReport !=
null
)
{
customReport.TenntId = abpSession.TenantId;
customReport.UserId = abpSession.UserId;
customReport.IocResolver =
this
.iocResolver;
}
var reportSource =
new
InstanceReportSource {ReportDocument = report};
return
reportSource;
}
}
and this is the ReportsController
[ApiExplorerSettings(IgnoreApi =
true
)]
public
class
ReportsController : ReportsControllerBase, ITransientDependency
{
public
ReportsController(IHostingEnvironment environment, IIocResolver iocResolver, IAbpSession abpSession)
{
this
.ReportServiceConfiguration =
new
ReportServiceConfiguration
{
HostAppId =
"Html5DemoApp"
,
Storage =
new
FileStorage(),
ReportResolver =
new
CustomReportResolver(iocResolver,abpSession)
};
}
}
I want to find a way to remove the Report Instance from the memory to avoid this memory leak issue.
Thanks,