Prevent endless loops in List & Label

Introduction

When printing or exporting, it can happen that the application runs into an endless loop and hangs.

This can have quite basically the most different causes. In most cases, however, it can be assumed that the problem is due to the different objects used in the report, or due to certain object combinations or their size.

Basically, we recommend to always install the latest service pack, so that problems that have already been corrected can be excluded in advance.

Below is a list of the most common causes based on experience.

Causes

Check the following possible causes to prevent endless loops:

Objects do not fit on page

Check whether objects on a page may no longer fit as a whole (e.g. in a table cell). These are normally wrapped if the affected object supports this, but for some objects/elements these must always be output as a whole (in one piece), this applies to images, for example. If an object no longer fits on one page, it is tried to output it on the next page, assuming that there is more space available there. If there is no more space on the next page(s), this can result in an infinite loop.

Image object too small

Check if image or similar objects do not fit on the page or in the table because they are too high. This can be the case, for example, if a fixed height is defined for the object, but this height is smaller than the height of the image. If necessary, the height can be set to 0 so that List & Label can calculate the optimal height for the column.

Block too small

Check whether objects that are contained in modules or subreports have possibly defined a fixed height that is greater than the height of the container.

RTF object too small

Check if the content in an RTF object is larger than the available space, e.g. if the RTF contains an image. This will cause an infinite loop because the image may be too large for the following pages as well.

PDF object too small

For PDF objects, check the Original Size property to make sure that the original size of the PDF is not larger than the printable area.

Report container too large

Check whether the report container is generally too large (width and height) and thus possibly extends far beyond the edge of the workspace.

Values calculated by formula do not fit to paper size

Check whether formulas return values that do not fit the selected paper size. In this case it is recommended to define the height/width of the report container using the variables ‘LL.Device.Page.Size.cy’ or ‘LL.Device.Page.Size.cx’.

Be sure to use the UnitFromSCM function especially when using formulas, but also for reports designed for different regional user settings.

Line breaks at the end of RTF texts

Check if there are any line breaks at the end of RTF texts that can cause an infinite loop. By setting the option LL_OPTION_SKIPRETURNATENDOFRTF to TRUE these line breaks can be ignored.

Further measures

Limit loop passes

Since version 24, loop repetitions can be limited with the option LL_OPTION_IDLEITERATIONCHECK_MAX_ITERATIONS so that one such recursion is recognized per object.

The print can then be aborted with the LL_ERR_IDLEITERATION_DETECTED option, so that at least no more endless loop would occur and the hanging of the application is thus prevented.

Note: This is only possible when using a DataProvider in .NET. If you use your own print loop, this option does not take effect, so that you would have to take care of an abort of the print at a self-defined time (e.g. by counting the output pages and aborting when an unrealistic number has been reached).

1 Like