Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

pdfsharp dll not working in batch mode

Posted on by Microsoft Employee

I have an issue with pdfsharp dll. I was able to use the dll in on a local dev instance to successfully merge two pdf files using x++ code. When I promote this dll to TEST in a different instance it fails to run in batch mode. It runs fine in interactive mode.

My server configuration

Local dev instance- AX 2012 R3 all in one  box where we have the SQL and SSRS on the same box.
TEST instance = AX 2012 2 AOS Server. 1 dedicated batch server and 1 ssrs server.

The process worked correctly on both AOS servers when running in interactive mode. It fails only in batch mode. Something that is not reflecting in CLR.

I have added the required dll files to both server\bin and client\ bind folder.

I have also done multiple compile and CIL generations and nothing seems to help.

Any suggestions on how to resolve this issue in batch.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: pdfsharp dll not working in batch mode

    Thank you for the responses. I was able to resolve the issue by adding to GAC following this thread. 

    community.dynamics.com/.../173842

  • Martin Dráb Profile Picture
    Martin Dráb 225,526 Super User on at
    RE: pdfsharp dll not working in batch mode

    If I understand you correctly, you executed code on server and it works in X++ but not when switched to CIL (without using if so).

    If so, it rules you the options that the library can't be loaded on server (because it can't be found or because it can't be loaded to an 64-bit process). It also proves that the problem isn't related to batch; it's about CIL. This kind of problem isolation is the why I asked my questions.

    Just to be sure, how exactly did you forced code run in X++ on server and then in CIL?

    The fact that an assembly can be load to AOS when using X++ runtime but it doesn't work in the same process when using CIL is highly unusual. I can't think of any realistic reason. Please use the Assembly Binding Log Viewer (on server) to collect more information about why it can't be loaded.

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,147 on at
    RE: pdfsharp dll not working in batch mode

    It is very likely that your DLL has been compiled to run on x86 architecture only, and does not support 64-bit execution, which is your AX AOS instance. It is simply not going to work.

    See one solution here, you must create a separate service which you could call from your AX AOS, and would do your PDF processing in 32 bit:

    community.dynamics.com/.../82783

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: pdfsharp dll not working in batch mode

    I used X++ runtime on the AOS and I confirmed that I have the dll in both server and client Bin directories.  This works fine running to screen.

    When running in CLR I get the error.  I have done full compile and CIL multiple times.

  • Martin Dráb Profile Picture
    Martin Dráb 225,526 Super User on at
    RE: pdfsharp dll not working in batch mode

    "The process works in interactive mode in interactive mode" didn't give me any new information. Please tell us whether you run your code on client or AOS and whether you use the X++ runtime or CLR (the runtime for CIL).

    If you run it on client, you're testing a completely different thing. The library or may not be installed on AOS at all.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: pdfsharp dll not working in batch mode

    Thank you for responding. The process works in interactive mode in interactive mode. It fails only in batch mode. 

    The error I get is as following error in batch mode. 

    Assembly containing type PdfSharp, Version=1.31.1789.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb::::PdfSharp.Pdf.PdfDocument is not referenced.

  • Martin Dráb Profile Picture
    Martin Dráb 225,526 Super User on at
    RE: pdfsharp dll not working in batch mode

    Please describe the problem - neither "not working" nor "it fails to run" is very detailed.

    Also, please confirm whether "The process worked correctly on both AOS servers when running in interactive mode" means that you ran the code on server.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,835 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,526 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans