The type initializer for 'UiPath.PDF.PdfReader' threw an exception

Hi guys,

I use the “GetPDFPageCount”-Activity in my process.
When I run the process on my PC out of the studio, everything works fine.

But when the process starts running on the production environment (with the same PDF file) the following error appears:
“The type initializer for ‘UiPath.PDF.PdfReader’ threw an exception.”

Has anybody a idea how the issue could be solved?

Thanks a lot

stack trace of the exception is:
message: at UiPath.PDF.PdfReader…ctor(String filePath, String password) at UiPath.PDF.Activities.PDF.GetPDFPageCount.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hi Michael,

Are the Studio versions identical? (local vs. prod)
If not, make sure your assembly files match. The error is pointing out that your dependencies are not exactly in the right state. You should check your activity package integrity.

I have fixed this issue by overwriting the .nuget\packages folder (you can find it in C:\Users\yourUser.nuget\packages) from local to prod environment. This folder stores your .dll assembly files that are used by the activity packages.

Hi Bianca,
the process on production environment will be started via orchestrator.
Usually the correct dependencies should be downloaded automatically, right?

Usually yes, but depending on the restrictions/limitations set on the machine, there might be some issues with syncing the dependencies, so the presence of the packages should be checked manually.