Skip to Content
0

Object reference not set to an instance of an object.

May 16, 2017 at 08:52 PM

488

avatar image
Former Member

We have the error when we preview report which contains several thousands of pages. We experience this issue only for reports which have sub-reports. Exception thrown after we scroll through the pages. Issue is inconsistent – it can happen on any page.

We can successfully save report as PDF file if we do it right after report shown in the preview control and before we scroll through the pages - and after that we can scroll through the PDF document without any errors.

Here is the trace for the exception:

2017-05-11 16:53:05.3967|ERROR|Triquestra.Common.Reports.StandalonePreview|Internal Crystal Report error

Exception: System.NullReferenceException: Object reference not set to an instance of an object.

at CrystalDecisions.CrystalReports.ViewerObjectModel.PageObject.CleanUpContent()

at CrystalDecisions.Windows.Forms.ReportDocumentBase.AddPage(PageObject page)

at CrystalDecisions.Windows.Forms.ReportDocumentBase.GetPage(Int32 pageN)

at CrystalDecisions.Windows.Forms.DocumentControl.ShowNthPage(Int32 PageNumber)

at CrystalDecisions.Windows.Forms.DocumentControl.ShowPreviousPage()

at CrystalDecisions.Windows.Forms.PageView.ShowPreviousPage()

Technical details:

Crystal Report runtime version is 13.0.20.2399 (32 bit).

Windows 10 with latest updates.

WinForm application (C#) build with .Net Framework 4.6.

We are using CrystalDecisions.Windows.Forms.CrystalReportViewer control to preview reports.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

8 Answers

Best Answer
Don Williams
May 17, 2017 at 10:13 PM
0

Hi Eduard,

On Demand subreport is the issue, not currently supported. You have to disable it in CR Designer. Or wait for SP 21. DEV is working on it but not sure at this point how it's going to work.

The Value is a String, not a DWORD.

And it's not going to work for OnDemand subreports anyways.

Don

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
May 16, 2017 at 09:05 PM
0

Hi Edward,

I changed the primary tag.

I have not seen this but typically you don't use that many pages. Easier to break the data into parts so it's easier to define the data previewed and less resources required. And a reminder CR is not a Database Archiving tool, DB Servers are much more efficient at doing that.

Are the subreports On Demand? if so it's a known issue. -

KBA - 2456246- OnDemand subreport generates instance not set to an instance of an object when drilling down

DEV is looking into it but surprisingly it was not supported, fix is to change the subreports to not be on demand.

See if this registry change helps:

HKEY_CURRENT_USER\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\DatabaseOptions -

ViewOutOfPlaceSubreports = Yes

And if you hit the Last Page button and Page back to the beginning does that work?

Don

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Don,

Thank you very much for the quick answer.

Yes, our subreport EnableOnDemand property has set to True and this property is read-only.

I don't see registry path provided by you. On my Windows 10 PC I have path [HKEY_CURRENT_USER\Software\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports\DatabaseOptions].

I've tried to add string/DWORD value ViewOutOfPlaceSubreports = Yes/1 but it didn't help - I still have the same error.

First and last buttons work fine but still the error when I scroll page by page.

Any other suggestion I can try?

Thank you, Eduard.

0
avatar image
Former Member May 18, 2017 at 04:01 AM
0

Just curious Don, you say you are not sure at this point how it's going to work... What changed in SP18 and what is making it difficult to fix in SP21?

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
May 18, 2017 at 02:05 PM
0

Hi Matt,

According to a KBA I found it never did work and therefore it was not supported.

So it worked for you in SP 18?

Not sure what DEV changed to break it for you since SP 18. There have been a few changes to the database drivers and CRQE Engine, Subreports now require you to log on, likely this forced change is what affected that part.

Until DEV looks into it I can't say what the cause was.

Don

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 18, 2017 at 02:17 PM
0

On demand sub reports have worked perfectly in my product since the release of 13. It broke when we updated to 13.0.18. If I run my product using 13.0.17, on demand sub reports work beautifully. There has never been an issue up until 13.0.18.

Also, in my issue, on demand sub reports work perfectly up until page 11. So it isn't a log on issue. My issue presents itself when navigating from page 10 to 11. We are discussing this issue probably on the wrong topic which you directed me to, my original issue was specifically detailed at the following post, which may be causing some of the confusion because my issue is not identicial to the issue described in this post, though it is similar.

https://answers.sap.com/questions/201030/index.html

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 18, 2017 at 04:16 PM
0

I have put together a very simple and quick video to demonstrate my specific issue, including how the sub report functions properly up until I attempt to go to page 11. This is consistent regardless of which report I load, and is always a problem with page 11.

https://resources.rock-pond.com/sap_example.mp4

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
May 24, 2017 at 07:42 PM
0

Is it possible to get your report with saved data?

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

We've recently upgraded from 2008 to 2013 SP 20 and I'm getting this exact same issue - if I just click next page on the toolbar or randomly click on the tree list - after 10 pages (pg 11) it errors with the above same stack trace. The report exports out to PDF fine, and there isn't a problem with the data. I've even rolled back to SP17 and still get the error. Searching these Q&A hasn't helped the issue.

0
Don Williams
May 25, 2017 at 12:44 PM
0

Howard found the cause and this will be fixed in SP 21 due out in August....

Share
10 |10000 characters needed characters left characters exceeded