Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PdfPig warning are wasting trace #758

Closed
marcRobertHabib opened this issue Jan 16, 2024 · 7 comments
Closed

PdfPig warning are wasting trace #758

marcRobertHabib opened this issue Jan 16, 2024 · 7 comments

Comments

@marcRobertHabib
Copy link

Thanks for your work,

We are writting an application reading thousands of PDF from an external source, and the application uses System.Diagnostics.Trace to write a log file.
I don't know why but we are getting for each document a lot of warnings like below in the trace:
Warning: 0 : 16/01/2024 14:54:47: Table with invalid checksum found in TrueType font file.
16/01/2024 14:54:47: Callstack= at System.Environment.get_StackTrace()
at System.Diagnostics.TraceListener.WriteFooter(TraceEventCache eventCache)
at System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args)
at UglyToad.PdfPig.Fonts.TrueType.Parser.TableParser.Parse[T](TrueTypeHeaderTable table, TrueTypeDataBytes data, Builder register)
at UglyToad.PdfPig.Fonts.TrueType.Parser.TrueTypeFontParser.ParseTables(Single version, IReadOnlyDictionary`2 tables, TrueTypeDataBytes data)
at UglyToad.PdfPig.Fonts.TrueType.Parser.TrueTypeFontParser.Parse(TrueTypeDataBytes data)
at UglyToad.PdfPig.PdfFonts.Parser.Parts.CidFontFactory.ReadDescriptorFile(FontDescriptor descriptor)
at UglyToad.PdfPig.PdfFonts.Parser.Parts.CidFontFactory.Generate(DictionaryToken dictionary)
at UglyToad.PdfPig.PdfFonts.Parser.Handlers.Type0FontHandler.ParseDescendant(DictionaryToken dictionary)
at UglyToad.PdfPig.PdfFonts.Parser.Handlers.Type0FontHandler...

And the log file becomes huge. Is there a way to prevent these messages?

Thanks

@BobLd
Copy link
Collaborator

BobLd commented Jan 16, 2024

@marcRobertHabib Are you using the NuGet package in your app? Or are you referencing the code directly? Are you getting these trace when running in Debug mode or Release mode?

@marcRobertHabib
Copy link
Author

marcRobertHabib commented Jan 16, 2024 via email

@BobLd
Copy link
Collaborator

BobLd commented Jan 16, 2024

@EliotJones Unless there's an actual reason why these logs are Trace and not Debug in PdfPig, I'll create a PR to change that.

As to why there's an exception here, I'm not sure.

@EliotJones
Copy link
Member

@BobLd I had moved them away from Debug.Assert because that plays badly with tests (if you hit a Debug.Assert in a test run the test runner just silently disappears). I don't mind going back to Debug because I can't really be bothered to propagate our Logger instances to all usages, or we can remove it entirely.

@marcRobertHabib
Copy link
Author

To solve my issue I added a filter to the trace.

Thanks.

@BobLd
Copy link
Collaborator

BobLd commented Jan 16, 2024

@EliotJones ah okay, that's odd indeed, I don't think I ever had the issue tbh.

I've created a PR to move to Debug, as a short term solution; but as you said, on the long run I think it would be better to propagate our Logger.

@BobLd
Copy link
Collaborator

BobLd commented Jan 17, 2024

@marcRobertHabib should be fix by #760, even without filters.

I'm closing the issue for now, but feel free to re-open if need be

@BobLd BobLd closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants