System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified

Hello,

To solve the issue PDFNET-48049 (System.NotImplementedException: PKCS#1 does not support ocsp, timestamp settings, use PKCS#7), which was fixed in version 24.12, I updated the version of Aspose.PDF from 22.1.0 to 25.3.0. After that, I encountered a new error: System.IO.FileNotFoundException: Could not load file or assembly ‘System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
image.png (4.7 KB)

After investigating, I found that there is an issue with references in Aspose.PDF NuGet. After installing Aspose.PDF version 25.3, System.Text.Encoding.CodePages 7.0.0 is installed:
image.png (11.6 KB)
image.png (15.6 KB)
image.png (13.4 KB)

But the manifest specifies version 5.0.0:
image.png (13.1 KB)

So when executed at runtime the application tries to find version 5.0.0 and cannot do so. As a result, an error appears.

I downloaded and manually replaced the System.Text.Encoding.CodePages.dll in the folder from version 7.0.0 to version 5.0.0 and the problem went away.
For me this looks like a bug and should be fixed in the Aspose.PDF NuGet, since it is impossible to use as is. Please advise if any other solutions or workarounds.

In my case the error appears in the following code:
image.png (15.3 KB)

Our application uses .NET Framework 4.8.

Regards,
Aliaksandr

@Aliaksandr.Siuchuk

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-59561

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.