Cause. A local report does not allow you to pass empty or null parameters, which I do not know, but this throws an exception.
Bugfix: one way to find out which parameter causes an Exception call var result = report.LocalReport.GetParameters(); method, in the array of results that it has result[0].State property, if it is MissingValidValue it throws an exception.
Example:
var rv = new ReportViewer { ProcessingMode = ProcessingMode.Local }; rv.LocalReport.ReportPath = Server.MapPath("~/PrintForms/FromForm.rdlc"); rv.LocalReport.Refresh(); string mimeType; string encoding; string filenameExtension; string[] streamids; Warning[] warnings; rv.LocalReport.SetParameters(new ReportParameter("ClientName", "გიორგი გიორგაძე")); rv.LocalReport.SetParameters(new ReportParameter("Account", "888"));var streamBytes = rv.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); return File(streamBytes, mimeType);
The code above works fine, but if you change the line for adding parameters to:
rv.LocalReport.SetParameters(new ReportParameter("Account", null));
The value of the ReportParameter State report will be MissingValidValue, and this will throw an exception.
Konstantine muradov
source share