Nuget
Microsoft.ReportingServices.ReportViewerControl.WebForms Version: 150.1484.0
Web config
<assemblies>
<!-- All assemblies updated to version 15.0.0.0. -->
<add assembly="Microsoft.ReportViewer.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.DataVisualization, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.Design, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.WebDesign, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.WinForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</assemblies>
Use case
ReportViewer viewer = new ReportViewer();
viewer.ProcessingMode = ProcessingMode.Local;
viewer.LocalReport.ReportEmbeddedResource = "MyReport.rdlc";
ReportDataSource rds = new ReportDataSource("MyDataSource", mytransactions);
viewer.LocalReport.SetParameters(new ReportParameter[] { p1 });
viewer.LocalReport.DataSources.Add(rds);
viewer.LocalReport.EnableHyperlinks = true;
byte[] bytes = null;
try
{
if (reportType == "pdf") bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
if (reportType == "excel") bytes = viewer.LocalReport.Render("Excel", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
}
catch (Exception ex)
{
Trace.WriteLine("ERROR: In Report " + ex.Message);
}
Exception when rendering is:
Failed to load expression host assembly. Details: Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. An API call exited abnormally. (Exception from HRESULT: 0x800300FA (STG_E_ABNORMALAPIEXIT))
Correct DLLs are in the Bin directory of the project.
Using .Net Framework 4.8
Visual Studio 2022 v17.1.1
Spent the day trying solutions. Emptied the Nuget cache, checked the GAC, restarted Visual Studio several times, cleaned and rebuilt the project several times.
I am at a loss. Meanwhile customer are yelling.
Any other ideas?