Skip to Content
0

Unhanded Exception When Cycling Through Report Pages

Mar 06, 2017 at 03:28 PM

109

avatar image

Hi,

Recently, I upgraded to CR 2016 designer and I upgraded our software to use CR runtime version 13_0_19.

I have a report that I had for a long time and has been working successfully for long time. But on this recent CR runtime , it is having problems when I cycle through the pages. Here are the steps I follow to get the error.

The report has 55 pages and it has a sub report inside it:

1- I click on "Go to Last Page"

2- I click 8 times on "Go to Previous Page"

3- I get an error message that says "Object reference not set to an instance of an object."

4- I click on "Go to First Page"

5- I get an error message "Unhandeld Exception has occurred in a component in your application ..... Cannot access a closed Stream" see details below

************** Exception Text **************
System.ObjectDisposedException: Cannot access a closed Stream. at System.IO.__Error.StreamIsClosed() at System.IO.MemoryStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.Drawing.Internal.GPStream..ctor(Stream stream) at System.Drawing.Bitmap..ctor(Stream stream) at CrystalDecisions.Shared.PageRender.draw_ImageInstance(ImageObjectInstance imageInst, Graphics g) at CrystalDecisions.Shared.PageRender.draw_ReportObjectInstance(ReportObjectInstance instance, Graphics g, Rectangle clipRect) at CrystalDecisions.Shared.PageRender.draw_SectionInstance(SectionInstance section, Graphics g, Rectangle clipRect) at CrystalDecisions.Shared.PageRender.Render(PageObject page, Graphics g, Graphics device_g) at CrystalDecisions.Windows.Forms.PageControl.OnPaint(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.UserControl.WndProc(Message& m) at CrystalDecisions.Windows.Forms.PageControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

P.S: If I remove the Sub-Report , it does not crash . Knowing that this report and its sub report works perfectly. I ONLY get the crash when I do the aforementioned steps.

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

5 Answers

avatar image
Former Member Mar 21, 2017 at 03:38 PM
0

I've seen the same thing. Appears to have been introduced in SP18. Occurs on reports with On Demand Subreports and seems to happen only when the total page count of the report is 10 or more pages. You can export fine. SP19 does not fix the problem, so we have rolled back to SP17 for the time being. Yours is the only other report I've seen of this issue.

Share
10 |10000 characters needed characters left characters exceeded
Mohamed Elashi Mar 23, 2017 at 08:29 PM
0

Thank you Matthew. Actually I tried to downgrade our CR runtime from version 13_0_19 to version 13_0_14 but the problem persisted. Even printing the report failed.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 27, 2017 at 03:37 PM
0

We're hanging on SP10. It does work on that version, if you can go back that far.

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Mar 31, 2017 at 01:22 PM
0

Hi Guys,

Mohamed logged a case with SAP - Incident 156727 / 2017 / Rendering report cause and exception in Page rendering

The problem is because changes to code requires you to set the log on info to the on demand subreport. I'll have to do more testing but I believe that is the reason why.

We no longer Propagate the connection info to the subreport or use the one from the main report. You specifically have to make the connection.

The other reason is the subreport is using a SQL Expression, this too may be the cause. I still need to test.

One more question, are you guys actually using Business One? Reason I ask is the B1 Server uses the 64 bit runtime only, so using SP 19 from CR for VS is not going to be supported by B1. Other reason could be you need to use a 64 bit ODBC DSN...

Don

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 31, 2017 at 02:27 PM
0

Don, thanks for the attention to this problem. Let me give you a more detailed version of our implementation and how the problem manifests. Maybe it will help you locate the problem.

For clarity, Mohamed and I don't work together so his situation may be different, but my particular environment is a VB.net Windows application written in Visual Studio 2015 Update 3 running SP18 or 19 of CR for VS and Crystal Reports 2016. We use an offline dataset that is set by the app at runtime through the ReportDocument.SetDataSource method. We set this for the main report and each of the subreports. We use the Crystal Report Viewer for display of the report in the application.

When a report with on-demand subreports is run, that report will take an object reference error after the report has displayed 10 pages AFTER the first on-demand subreport. So if the first sub is on page 1, I'll take the error paging from page 10 to 11. If it's on page 2, then the error occurs paging from 11 to 12. The same report with all on-demand subs suppressed will not take this error and the error will occur whether the report has 1 or multiple on-demand subs. If the report is less than 10 pages in total, we won't see the error. So it's definitely pages and not # of subs displayed that causes the error.

We aren't using SQL Expressions or Business One, nor does the report use an ODBC datasource. At runtime all of the data is passed to the report through the SetDatasource Method.

Thanks again, Don. Please let me know what you find, or if there is any sort of work around we can consider implementing until a permanent fix can be coded. If necessary, we can provide a sample application that will demonstrate the problem.

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

I'm having the exact same issue as @MatthewCreelman above. We recently upgraded from 2008 to 2013 SP20 runtimes and get the same problem - even randomly clicking on the tree on the left it will error on the 11th page it tries to load. Exporting to pdf works find and the data is all ok. We set the "reportDocument.DataSourceConnections", "Database.Tables" and "Database.Links" LogOnInfo, as well as for all sub reports - but we get the above error without even drilling into any sub reports.

0