views:

122

answers:

1

Hi,

I have a WinForms 2.0 application with about 18 Reports created with Microsoft ReportViewer. Every time a report is started there is a dynamic assembly created (expression_host_xxxxxx.dll). This dynamic assembly is loaded in memory and is there to stay for the remainder of the application runtime consuming resources. Even if we only have 1 report and we start this ie 3 times, we get 3 such expression_host assemblies in memory.

Is there a way to prevent these assemblies from being created or to unload these assemblies after we are done?

TIA

+2  A: 

I already found a solution. On the reportviewer control you can signify to execute the report in an so-called sandbox app-domain:

`rpv1.LocalReport.ExecuteReportInSandboxAppDomain();`

This will not prevent the creation of the Expression_Host assemblies because these are necessary to evaluate the expressions you have used in your report. It will however start the report in a new application domain. That new application domain is then unloaded after the report is finished and as a result, any loaded assembly in that domain is also unloaded.

Huberto