Null reference at StartProcessing method on remote server [windows azure]

Dec 4, 2013 at 7:29 PM
Edited Dec 5, 2013 at 2:09 PM
Hello,

I am using this Ghostscript to convert pdf to png, the code almost identical as first method in this sample .
It works perfectly on my local machine, but it failed when I deploy it to the windows azure. As i mentioned in title I am getting null reference exception in StartProcessing method.

Ghostscript is installed on a server and I able to verify this using
GhostscriptVersionInfo.GetLastInstalledVersion
This wrapper is pretty new and I can't find anything meaningful across the internet.

Any directions where to look for the issue would be helpful. I am appreciate your time and thank you for the amazing job.

Thank you, Andrew.

Update

  1. Possible issue: not work with .net 4.5
Coordinator
Dec 5, 2013 at 1:46 PM
Hi Andrew,

Can you please let me know if GhostscriptProcessor sample works on windows azure for you?

Meanwhile i will implement better exception handling for the next release.

Cheers,
Josip
Dec 5, 2013 at 2:00 PM
Edited Dec 5, 2013 at 2:08 PM
Hi Josip,

Thank you for the reply.

What I eventually did is wrote very simple console app that works on windows azure:
          static void Main(string[] args)
          {
           var pathToPdfFile = args[0];
            var outputPath = args[1];

            var lastInstalledVersion = GhostscriptVersionInfo.GetLastInstalledVersion(
                  GhostscriptLicense.GPL | GhostscriptLicense.AFPL, GhostscriptLicense.GPL);
            Console.WriteLine(lastInstalledVersion);

            var dev = new GhostscriptPngDevice(GhostscriptPngDeviceType.Png256);
            dev.ResolutionXY = new GhostscriptImageDeviceResolution(76, 76);
            dev.InputFiles.Add(pathToPdfFile);
            dev.Pdf.FirstPage = 1;
            dev.Pdf.LastPage = 1;
            dev.OutputPath = outputPath;
            dev.BackgroundColor = Color.White;
            dev.Process();
         } 
When I created this simple console app based on .net 4.5 it failed to work on my local machine with same null reference exception as on azure.
Just for fun I switched it to .net 4.0 and it's worked. Bingo! I did the same with my mvc 4 api, but no luck :(

Because of time concerns, my azure deployment running above console app and everything work, but I still don't understand what is causing this issue.
Perhaps there is issue with .net 4.5. I'd love to continue my investigation, but running out of time at the moment.

P.S. I'll be watching updates!

Thank you, Andrew.