@William Buchanan I just tested the latest release (150.1449.0) and the issue has been resolved for me. Give it a try.
ReportViewer control errors - object reference erro
Hi
I am using the report viewer in an ASP.NET MVC application. It has been working up until v 150.1427.0. If I try to upgrade to that version, or the latest all I see on the page is a single line of text saying 'Object reference not set to an instance of an object.'.
Is this a known issue?
Just to note - I made no other changes to the project, other than updating the reportviewer via Nuget. Going back to the previous version fixes the problem. Also to note this doesn't happen on all reports - it is only happening on some of them.
Thanks
SQL Server Reporting Services
3 additional answers
Sort by: Most helpful
-
Stewart, Beth 86 Reputation points
2021-03-02T19:52:42.63+00:00 I am having this problem as well. Beginning with version 150.1440, if a report has a DateTime parameter that accepts nulls and has a default value of NULL specified, the report viewer displays "object reference not set to an instance of an object" when the report is loaded. Here is the stack trace:
Object reference not set to an instance of an object at Microsoft.ReportingServices.Common.DateTimeUtil.ParseDateToAdditionalSettingFormat(String strDateTime, CultureInfo formatProvider) at Microsoft.Reporting.WebForms.ParameterInputControlFactory.Create(ReportParameterInfo reportParam, Boolean allowQueryExecution, Boolean positioningMode) at Microsoft.Reporting.WebForms.ParameterControlCollection.Create(ReportParameterInfoCollection reportParams, Boolean allowQueryExecution, IReportViewerStyles styles, Boolean showHiddenParameters, Boolean positioningMode) at Microsoft.Reporting.WebForms.ParametersArea.CreateChildControls()
-
Stewart, Beth 86 Reputation points
2021-03-02T19:59:40.7+00:00 Also @William Buchanan if you want to see the full error you can add an error handler to the report viewer like this:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote"
Width="100%" Height="100%" BackColor="White" OnReportError="ReportViewer1_ReportError">
</rsweb:ReportViewer>Then you can add code to handle the error (and see its details). That's how I got the full info.
-
Joyzhao-MSFT 15,631 Reputation points
2021-03-02T02:29:31.557+00:00 Hi @William Buchanan ,
Variables in .NET are either reference types or value types. Value types are primitives such as integers and booleans or structures (and can be identified because they inherit from System.ValueType). Boolean variables, when declared, have a default value:bool mybool; //mybool == false
Reference types, when declared, do not have a default value:
class ExampleClass { } ExampleClass exampleClass; //== null
If you try to access a member of a class instance using a null reference then you get a System.NullReferenceException. Which is the same as Object reference not set to an instance of an object.
This question already has answers here: What is a NullReferenceException, and how do I fix it?
You could also refer to: Debugging System.NullReferenceException-Object reference not set to an instance of an object.
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.