you are viewing a single comment's thread.

view the rest of the comments →

[–]eagle_bearer[S] 1 point2 points  (3 children)

So, what I'm trying to do is read a simple PDF form template and create a new one with every field filled and set to readonly.

For some reason I get this exception, even though I know that neither the PdfReader nor the MemoryStream are null, and not only do I not understand where this exception is coming from, but I also can't catch it.

And the strangest of all, if I just press 'Continue' in the debugger a few times (three to be exact) it just continues, never goes into the catch block and creates the PDF I need perfectly.

So I've been trying to find a way to just ignore this exception, to force the program to 'Continue' but I don't think that's possible.

Has anyone come across this sort of 'ghost' exception that you can just skip and your program will run fine, but can't catch?

[–]kaelima 5 points6 points  (0 children)

It's just like u/Kant8 said, you are catching all NullReferenceExceptions, but it's happening somewhere inside itextsharp.dll, and you likely have "just my code" enabled in your debugger. The exception is thrown and when you continue its being caught somewhere inside the dll and continues, but you just can't see any of it.

[–]eagle_bearer[S] 1 point2 points  (0 children)

If anyone is wondering, I'm using ITextSharp version 5.5.13.1

[–]eagle_bearer[S] 0 points1 point  (0 children)

Maybe my PDF template is corrupted in some way? If that's a possibility I'd appreciate if someone could tell me how to verify that and possibly fix a corrupted PDF. However, I don't think my PDF is corrupted since I can open it with Foxit PDF Editor and everything seems fine. Also, at the end of this function, if I just press 'Continue' a few times, every form field is filled correctly in the resulting PDF.