PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

6.0.0-preview-2: 'ParagraphIterator' must not be null here.
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4445
Page 1 of 1

Author:  duckworth [ Fri May 26, 2023 10:23 am ]
Post subject:  6.0.0-preview-2: 'ParagraphIterator' must not be null here.

Hi-
I am totally new to PDFsharp & MigraDoc. (used itextsharp in the past)
I've been tasked with upgrading one of our tools to .NET 6.0.
Looks like preview-2 is in process of moving to .NET6 as well, so I upgraded our application to use PDFsharp-MigraDoc-GDI (6.0.0-preview-2)

However, when I run a test, I am getting the following exception:

System.InvalidOperationException: 'ParagraphIterator' must not be null here.
at PdfSharp.Diagnostics.NRT.ThrowOnNull[TResult](String message)
at MigraDoc.Rendering.ParagraphRenderer.InitFormat(Area area, FormatInfo previousFormatInfo)
at MigraDoc.Rendering.ParagraphRenderer.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()
...


I checked the known issues for 6.0.0-preview-2, but didn't see anything.
Has anyone else experienced this?
This is probably due to incorrect setup in our application of course. But as I have virtually no experience with our own tool, and we have no support, I thought I would ask here first if there is some obvious issue that could be easily fixed before I dive into it.

Many thanks!
duckworth

Author:  TH-Soft [ Fri May 26, 2023 12:44 pm ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

Thanks for the feedback.

We would check what's going on if we could replicate the issue.
See also:
https://docs.pdfsharp.net/General/IssueReporting.html

Author:  duckworth [ Fri May 26, 2023 9:59 pm ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

Thanks.
I'll get something together to replicate the issue this weekend and following the IssueReporting link.
(I was hoping there would be an "oh, it's obvious, you forgot to do this..." answer :-) )
The samples that are available for the prior to .NET6 version all should work on this 6.0.0-preview-2 version, correct?

duckworth

Author:  TH-Soft [ Tue May 30, 2023 7:42 am ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

duckworth wrote:
The samples that are available for the prior to .NET6 version all should work on this 6.0.0-preview-2 version, correct?
I think so. But few require code changes to make them compile.

Author:  Thomas Hoevel [ Thu Jun 01, 2023 9:19 am ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

duckworth wrote:
(I was hoping there would be an "oh, it's obvious, you forgot to do this..." answer :-) )
I checked the source code and it seems there is a new check that is too strict.
However, the check gets never triggered with our test code.

I think we'll remove that check with preview-3 anyway, but if we get sample code from you that triggers the check and allows us to verify that everything works fine when the check is removed, this would be great. Thanks in advance.

Author:  haggis777 [ Thu Jun 08, 2023 4:36 am ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

I am also running into this error. What's strange is my test work fine and do not return this error, but when I use it in a web api, it is generating the error.

When is preview 3 being released?

Author:  haggis777 [ Thu Jun 08, 2023 5:03 am ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

I believe I can reproduce this error now. When I create a paragraph and add text to it that has a return on it, I am getting the error:
Code:
var paragraph = section.AddParagraph();
paragraph.AddText("\n");

Now, if I add a space after the return like so:
Code:
paragraph.AddText("\n ");

Seems to work fine.

Author:  Thomas Hoevel [ Mon Jun 12, 2023 7:27 am ]
Post subject:  Re: 6.0.0-preview-2: 'ParagraphIterator' must not be null he

haggis777 wrote:
I believe I can reproduce this error now. When I create a paragraph and add text to it that has a return on it, I am getting the error:
Code:
var paragraph = section.AddParagraph();
paragraph.AddText("\n");
Sorry, but I don't get an error with that code.

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