question

AndrewPolden-3164 avatar image
0 Votes"
AndrewPolden-3164 asked AndrewPolden-3164 commented

ReportViewer bug: NullReference exception parsing null date parameters

Apologies if this is not the correct place; all obsolete links and roads led me here nonetheless. There appears to be a regression in recent datetime parsing changes to the Windows Forms Report Viewer control in NuGet package Microsoft.ReportingServices.ReportViewerControl.Winforms version 150.1427.0. If I supply a null value for a Date/Time parameter which is set to Allow null value, the report viewer throws a NullReferenceException during load/refresh. The exception is first thrown in the (presumably new) method Microsoft.ReportingServices.Common.DateTimeUtil.ParseDateToAdditionalSettingFormat(String strDateTime, CultureInfo formatProvider). The release notes mention a change concerning datetime parsing. The issue does not occur in the prior version, 150.1404.0.

Repro steps:

  1. Create a new, empty report,

  2. Add one parameter: Date/Time type and allow null values,

  3. Configure the report viewer to load the report, and call LocalReport.SetParameters() with a single ReportParameter object with a null value,

  4. Call RefreshReport(); the exception is thrown.

Trying again, supply a non-null value for the parameter does not cause a problem. Is there a possible work around I might use until this is fixed that I might use, without having revert to the earlier package version?








sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered AndrewPolden-3164 commented

Hi @AndrewPolden-3164
There is a similar case before: https://docs.microsoft.com/en-us/answers/questions/265839/systemnullreferenceexception-in-datetimeutilparsed.html
I found that there is already the latest ReportViewerControl.Winforms version, you could try it and check if the problem is resolved in the latest version.

If it still doesn’t improve,,I suggest you submit the requirement at https://feedback.azure.com/forums/908035-sql-server.
If the requirement mentioned by customers for many times, the product team may consider to add this feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase the level of service provided.
Best Regards,
Joy


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Joyzhao-MSFT, I have lodged a bug report at the location requested, but I'm not entirely sure my issue has been correctly understood. I'm not reporting a feature request, but a feature regression, a bug in the second to latest and latest versions of the report viewer control, not with SQL Server or its components.

0 Votes 0 ·
Joyzhao-MSFT avatar image Joyzhao-MSFT AndrewPolden-3164 ·

Hi Andrew,

Yes, I fully understand your concern, report viewer belongs to SSRS and SQL Server product team. The feedback website it correct to post such issue. I hope you could understand this forum could not merely do anything to the inside of the component or change any structure or source code. What you reported is beyond the scope of this forum.

I would also try to report this internal, hope it helps.

Regards,
Joy

1 Vote 1 ·

Thank you Joy. I wasn't sure the forum was the best place for a bug report in the first place, but I'm glad it got there in the end.

0 Votes 0 ·