Didstopia / PDFSharp

A .NET Standard 2.0 library for reading, writing and editing PDF files.
MIT License
52 stars 18 forks source link

Resolves #14 and adds a test case #22

Closed WilStead closed 6 years ago

WilStead commented 6 years ago

I found the source of the null reference @KokomiShiina encountered and provided a workaround.

The workaround is admittedly a bit of a hack. I was unable to decipher what the expected behavior should be to avoid getting a null value in the first place, so I simply supplied the appropriate value for the missing reference, if and when it occurs. The fix seems to stand up to simple testing.

I also added a sample AcroForm PDF and a new test case to the test project.

Dids commented 6 years ago

Looks like the test you've added is failing?

Failed   Didstopia.PDFSharp.Tests.PDFSharpTests.TextAcroForms
Error Message:
 System.InvalidOperationException : Must not change font resolver after is was once used.
WilStead commented 6 years ago

I think I see the issue. If the tests are run in isolation the code works, but when run concurrently the global font resolver is set multiple times, which is disallowed. I've added guards to ensure that, regardless of what order the tests get run by the test harness, the resolver is only set once.

Dids commented 6 years ago

Thanks!