PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

After upgrading to 1.50.5147 getting Index was out of range
http://forum.pdfsharp.com/viewtopic.php?f=2&t=3970
Page 1 of 1

Author:  briankitt [ Fri May 24, 2019 3:36 am ]
Post subject:  After upgrading to 1.50.5147 getting Index was out of range

I have a report that has not changed in years. This weekend, suddenly started getting this error. I won't rule out that this might not be bad data on my part, but have no idea where to go. This report is more than 1,000 pages long, it's not going to be easy to find the bad data.

I couldn't possible include all of the code here, this report is far too complex. It's crashing on the 'RenderDocument()';

PdfDocumentRenderer myRender = new PdfDocumentRenderer(true);
myRender.Document = myDocument;
myRender.RenderDocument();
myRender.Save(reportPath);

StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at MigraDoc.Rendering.TableRenderer.FinishLayoutInfo(Area area, XUnit currentHeight, XUnit startingHeight)
at MigraDoc.Rendering.TableRenderer.Format(Area area, FormatInfo previousFormatInfo)
at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel)
at MigraDoc.Rendering.FormattedDocument.Format(XGraphics gfx)
at MigraDoc.Rendering.DocumentRenderer.PrepareDocument()
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely)
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareRenderPages()
at MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument()

Author:  () => true [ Fri May 24, 2019 9:44 am ]
Post subject:  Re: After upgrading to 1.50.5147 getting Index was out of ra

briankitt wrote:
This report is more than 1,000 pages long, it's not going to be easy to find the bad data.
If we had the 1000 pages we could start searching for the cause. Without a single page I don't know where to start searching.
An MDDDL file might help us.
http://pdfsharp.net/wiki/MigraDocDDL.ashx

Author:  briankitt [ Fri May 24, 2019 6:21 pm ]
Post subject:  Re: After upgrading to 1.50.5147 getting Index was out of ra

I'll work on getting a file as per your request.

Author:  briankitt [ Fri May 24, 2019 8:36 pm ]
Post subject:  Re: After upgrading to 1.50.5147 getting Index was out of ra

I worked to get it as small as I can, yet, still have the issue. Raw file is still 20 MB

I hope .rar works for you. When I used .zip it exceeded maximum size.

Attachments:
MDDDL.rar [87.25 KiB]
Downloaded 373 times

Author:  briankitt [ Tue May 28, 2019 5:43 am ]
Post subject:  Re: After upgrading to 1.50.5147 getting Index was out of ra

I found the problem!

There was one situation, where I had a table initialized, but due to a quirky logic error, I initialized it a second time, before I added the columns.

However, this for sure did happen on the old release, and the old release ignored it. This code has not changed in a long time, so PDFSharp used to handle this.

So I fixed my logic error, and I'm working fine now. It would be helpful to have a slightly more useful error message.

The DDL does show that I have a table with no columns or rows.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/