Search code examples
c#asp.netdevexpressxtrareport

NullReferenceException on DevExpress 16.2.1 XtraReport generation via ReportService on WebForms


When using ReportService as report provider for AspxDocumentViewer in DevExpress 2016 ver.1.2 "Object reference not set to an instance of an object" is shown as JS alert in browser when trying to show report.

Caught internal exception has next info:

Object reference not set to an instance of an object.
    at DevExpress.XtraReports.Web.Native.ReportRenderHelper.GetPreparedOptions() 
    at DevExpress.XtraReports.Web.Native.DocumentViewer.RemoteReportRenderHelper.CreatePageWebControl(IImageRepository imageRepository, Int32 pageIndex)
    at DevExpress.XtraReports.Web.Native.ReportRenderHelper.WritePage(Int32 pageIndex)
    at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerReportWebRemoteMediator.<>c__DisplayClass2.b__1(PrintingSystemBase printingSystem)
    at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerRemoteHelper.DoWithRemoteDocument[T](Byte[] bytes, Int32 pageIndex, Int32 pageCount, Func`2 func)
    at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerReportWebRemoteMediator.GetPage(ReportViewer viewer, RemoteDocumentInformation documentInformation, Int32 pageIndex)
    at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerReportViewer.CallbackRemotePage()\r\n   at DevExpress.XtraReports.Web.ReportViewer.GetCallbackResult()
    at DevExpress.XtraReports.Web.ASPxDocumentViewer.GetCallbackResult()
    at DevExpress.Web.ASPxWebControl.System.Web.UI.ICallbackEventHandler.GetCallbackResult()

During small investigation 've noticed that report generation crashes after request to ReportService.GetPages method somewhere in inner DevExpress code.

Pay attention, that same solution works ok using DevExpress 15.2.7 so it's some kind of breaking changes between two versions.

Same solution also works in current version when report is set directly to AspxDocumentViewer.Report (not using ReportServiceClientFactory and ReportService), so it seems to be a ReportService issue.

ASP.Net WebForms application, report is as simple as possible (empty, no data usage).

Was created ticket on DevExpress site and it has in attach sample application to reproduce problem.


Solution

  • When using ReportService as report provider for AspxDocumentViewer in DevExpress 2016 ver.1.2 "Object reference not set to an instance of an object" is shown as JS alert in a browser when trying to show report.

    I see that you are using the alpha version (2016 ver.1.2). AFAIK this issue is already fixed with maintenance update 16.1.5 released on 2 August 2016.
    Thus, upgrade the DX Suite to resolve this issue.