ReportViewer - Object reference not set to an instance of an object

Viewed 862

Having hard time getting ReportViewer control to run reports that have optional (NULL) parameters.

Reports are running fine directly on SSRS within browser, but when I try to run them inside ASP NET WebForm app I am getting null reference errors if optional parameter is set to null (null checkbox is cheeked).

I am getting this (misleading) StackTrace message: at icrosoft.ReportingServices.Common.DateTimeUtil.ParseDateToDefaultFormat => seems that this is some date parsing issue but parameters was integers, strings (no date time parsing is required).

I am using Microsoft.ReportViewer.WebForms, Version=15.0.0.0 with SSRS 2017 and sample app is built using this official documentation: https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql-server-ver15

2 Answers

I had the same issue after upgrading to 150.1427.0 version of nuget package. It appears when I pass int or datetime values as parameters

Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.Common.DateTimeUtil.ParseDateToDefaultFormat(String strDateTime, CultureInfo formatProvider)
at Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters)

According to the release notes they "Fixed a datetime parsing issue affecting certain locales." https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/release-notes-ssrs-application-integration?view=sql-server-ver15

So I downgraded to version 150.1404.0 and the issue has gone

If you upgrade to version 150.1449.0 (or higher), then that resolves the bug that produced this error.

Related