Rendering Output Failed for Report in Business Central

DoufuDoufu
2 min read

We have a customer who had encountered these error when printing reports (i.e. Sales Invoice).

"Rendering output for the report failed and the following error occurred: Exception of type 'System.OutOfMemoryException' was thrown."

"Rendering output for the report failed. Stream was too long".

And it only happens to some of the Sales records, especially those with a lot of Sales Lines, which could generate a document of a few hundred pages long.

Typical causes for these errors are due to:

  • Infinite loops from code errors

  • Too much data in datasets, hence exceeding system limits

  • BLOB, Picture, Media data types that are added to the reports

Further investigations yielded no results and the error persisted after we stripped the report down to using minimal datasets. Hence it could not be the amount of records that was retrieved. Reviewing the issues, we realized that the only culprit could be the company logo in "Company Information".

It turns out the customer had uploaded their new company logo recently with a file size of almost 2MB. Imagine loading this for a few hundred pages, no wonder it ran out of memory.

The solution was to upload a re-sized version of the company logo. Alternatively, we were thinking of putting the logo in the RDLC report instead of loading it from the dataset, but that would mean the customer will not be able to change their logo in the report by themselves.

0
Subscribe to my newsletter

Read articles from Doufu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Doufu
Doufu

Current project developments on Microsoft platforms such as Business Central, Dynamics 365 Sales, Power Platform and occasionally Python. Used to get my paws dirty on Android and Web development.