Reputation: 63
First off, the error doesn't occur when running locally, only when I have it published to the web server (Server 2008 R2). The error message (first portion) that gets returned is:
MICROSOFT.REPORTING.WEBFORMS.LOCALPROCESSINGEXCEPTION: AN ERROR OCCURRED DURING LOCAL REPORT PROCESSING. ---> SYSTEM.NULLREFERENCEEXCEPTION: OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT. A MICROSOFT.REPORTINGSERVICES.RENDERING.HPBPROCESSING.TABLIX.UPDATETOPITEMKT(PAGEITEM TOPITEM, ROWINFO ROWINFO, PAGEDETAILCELL CURRCELL)
The code snippet that is rendering the report is in VB.Net...
Dim report As LocalReport = New LocalReport()
report.DataSources.Clear()
report.ReportPath = "App_GlobalResources\MyReport.rdlc"
report.DataSources.Add(New ReportDataSource("MyDataSource", MyDataTable))
report.Refresh()
Dim byteReport As Byte() = New Byte() {}
'The next line is where it fails with the exception above.
byteReport = report.Render("pdf") 'Get bytes to use with memory stream
We do have other reports that work fine using the same code, but this report uses the Row Groups in the table to group data together with a heading...the ones that work do not use the row groups.
Again, this only happens when posted to the web server. I have found a couple links that seem to be similar (one below), but wanted to see if anyone had experienced this. ReportViewer export to PDF Null reference
Upvotes: 0
Views: 1644
Reputation: 63
I was able to find a fix that worked for me and resolved this issue, so hopefully it will help others that come across this question.
We were developing in VS2010 when we created our first rdlc using MS ReportViewer 2010. We have since upgraded to VS2013 and .Net 4.5 and we never touched our existing rdlc because everything continued to work. When we created the new rdlc's, we targeted MS ReportViewer 2010 again, however the new reports that were using the table control and row groups to group data within the table would fail when they were deployed to a web server.
What I did was I installed the MS ReportViewer 2012 Runtime (if needed) so that I could reference the newer dll. I then installed it on the web server as well. Note: You might be prompted to install Microsoft® System CLR Types for Microsoft® SQL Server® 2012. You can find the x86/x64 downloads near the bottom of the Install Instructions.
Once I re-published the updated website to the updated web server, everything worked without errors. I did notice that my formatting was a little different using 2012 than it was in 2010, but the changes required to resolve those differences were minimal.
Upvotes: 1