This project is read-only.

Attempted to read or write protected memory

Apr 8, 2016 at 8:00 PM
I'm getting the following error:
An unhandled exception of type 'System.AccessViolationException' occurred in Ghostscript.NET.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I get this exception when an instance of the GhostscriptRasterizer tries to free up memory after another exception is handled. Basically, I am using this Ghostscript.NET wrapper to be able to convert PDF files to images. However, I've added an exception handler for PDF files requiring a password. For now, I don't want them to be able to convert these protected documents.

After handling a FormatException (which is thrown when trying to use a protected PDF), it still give the above error. Handling the error doesn't help, still crashes.

Any ideas? Is this project still being updated at all?
Apr 8, 2016 at 8:19 PM
The way I got around this problem (I don't think this issue is fixable at this point):

I am also using iTextSharp in my program. So I wrote a method using iTextSharp to check if the PDF file is password protected first, using help from this thread:

So now I am checking for the problem before I run into it. It's the only way I've found around this problem.