input.zip (85.2 KB)
Using the code example in following link throws exception
input.pdf (202.9 KB)
Unhandled exception. System.IO.FileLoadException: Could not load file or assembly ‘System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. The located assembly’s manifest definition does not match the assembly reference. (0x80131040) File name: ‘System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ at GroupDocs.WrpGen.Interop.ExchangeHost.InitServices()
@tahir.manzoor
Summary
The conversion fails because the runtime cannot locate the System.Text.Encoding.CodePages assembly with the version that GroupDocs Conversion (v 25.10.0) expects (8.0.0.0). Your project currently restores an older 4.7.0 version, leading to a FileLoadException.
Why it happens
- GroupDocs Conversion is built for .NET 8 and has a hard reference to
System.Text.Encoding.CodePages, Version=8.0.0.0.
- The NuGet restore pulled version 4.7.0 of that package, which has assembly version 4.7.0.0.
- When the library initializes its internal services, the CLR looks for the 8.0.0.0 assembly, cannot find a matching one, and throws the exception.
What to do next
- Add the correct package version
dotnet add package System.Text.Encoding.CodePages --version 8.0.0
This installs the assembly whose version matches the .NET 8 runtime (8.0.0.0).
- Register the code‑page provider – required for many conversions.
In the application entry point (e.g., Program.cs) add:
using System.Text;
using System.Text.Encoding.CodePages;
// Must be called before any conversion operation
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- Restore and rebuild the project
dotnet clean
dotnet restore
dotnet build
After the build, verify that obj/project.assets.json lists System.Text.Encoding.CodePages version 8.0.0.
- If you are using the Python wrapper
- Ensure the wrapper references the rebuilt .NET project (or the updated NuGet package).
- Trigger the provider registration from Python by invoking the wrapper’s initialization method before the first conversion call.
- Optional – enforce the newer assembly via a package update
If you cannot change the explicit version reference, add an update entry to the .csproj:
<ItemGroup>
<PackageReference Update="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>
This forces the build to use the 8.0.0 package even when other packages reference an older version.
- Run the conversion again
Execute the same sample code from the GroupDocs Conversion documentation. The FileLoadException should no longer appear, and the document should be converted successfully.
If the problem persists after these steps, capture the new exception details and confirm that the System.Text.Encoding.CodePages.dll with version 8.0.0.0 is present in the output directory. This information will help us investigate further internally.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
Can you please share the step how to use it? It was working without any wrapper references.
@tahir.manzoor
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): CONVERSIONPYTHON-37
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.