Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Attempted to read or write protected |
Post Reply ![]() |
Author | |
rgoodson ![]() Beginner ![]() Joined: 10 Oct 08 Location: United States Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() Posted: 02 May 10 at 1:58AM |
Hello,
I am using Visual Basic 2008 and the QuickPDFDLL0718.dll file to develop my application. I have added the QuickPDFDLL0718.dll file to my application's directory as well as add the file QuickPDFDLL0718.vb to my application. The methods work correctly, however I keep getting the error message "Attempted to read or write protected memory" every time I call the quick pdf methods. I have created a very small sample application that demonstrates the problem.
Is there somewhere that I can email that application to you so that you can take a look at it for me?
I really appreciate your help.
Reagan
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Reagan!
This is not a real QuickPDF-problem... more a dll-.NET-problem. You should google with the error string... If you want to upload it here you can use the official support pages: http://www.quickpdflibrary.com/ Cheers, Ingo Edited by Ingo - 02 May 10 at 10:17AM |
|
![]() |
|
rgoodson ![]() Beginner ![]() Joined: 10 Oct 08 Location: United States Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
Actually, I have googled the error and it says that it is an error that can occur when your are using non-managed code within managed code, which is exactly what is going on with the QuickPDF dll, since it is not a .Net assembly. I never get the problem until I call the QuickPDF code, and then it occurs every time. Also, when I run the compiled version of the sample app I get an unhandled exception saying ""Value cannot be null. Parameter name: ptr" and then it goes on to reference some information about the QuickPDF dll. I can give you that application as well.
It appears that there is some kind of memory leak within the QuickPDF dll file. I just want somebody to please take a look at it, since I have paid for the QuickPDF tool but am unable to use it due to this error. Its very frustrating because the support guy "Rowan" will not respond to my request, even though I have spent hours working to narrow down this error as much as I possibly can.
I would appreciate any help that you can provide me.
Thanks,
Reagan
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Reagan!
It's not the best calling unmanaged code from managed code but you can do it. You should read further (and deeper) on the msdn-pages. There's a lot of stuff regarding this fact. "Value cannot be null" ... it seems that an object should be called but it wasn't already created 'cause some things are missing. Please read here: http://www.quickpdflibrary.com/help/getting-started.php There you will find all about how to call a dll and how to do this with .NET... If there are still problems AFTER this you should post/upload your stuff on the official support pages. This here is only a user-user-forum (you should know this already) and i'm only a user, too. With "DLLImport" and the Marshal-syntax your problem should be solved. Give Google a try. Cheers, Ingo |
|
![]() |
|
johnr ![]() Beginner ![]() Joined: 11 Aug 10 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
Ah ha! I ran into the exact same problem just today.
Yet I have an additional observation:
Running vb dotnet 2010, I've successfully used the same dll method you are using to use quick pdf in the vb dotnet environment without running into the memory error for weeks, in loops that call the dll hundreds of times.
I did this by simply tweaking the sample vb .net application, no issues.
Today was the first time I tried adding the dll to an existing vb application, updating the dll path and copying that dll to my program directory, and started getting the same memory message from 5 to 30 seconds after the first time I call upon the quick pdf dll.
I haven't yet examined the differences, but I suspect you can work around your problem by downloading and modifying the sample vb dll project to meet your needs. (let us know if you can confirm this).
It's all I have at the moment, but you're not alone in getting that memory message.
|
|
![]() |
|
that0th3rGuy ![]() Beginner ![]() ![]() Joined: 01 Sep 10 Location: South Africa Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Hi there,
So, considering that I'm replying to this thread, you can assume that I'm having a similar problem. We collect utility usage data from various meters in the field and store it in our database. From the database we generate itemized bills for our clients in PDF format. The PDF document also has a logo and two graphs (all of these using the pdfDoc.DrawImage() function). The thing I find a little funny is that I get the error on every second generated document - the first document generates, and then the second one fails. So what I did (as a temporary solution) I added a loop that attempt to generate the document again when it fails (up to a maximum of 5 retries) and when popping a message box with the number of retries I get '2' every time (the loop is effective in that it works every time now, but it's not ideal at all). It's almost like the occurrence of the exception is clearing that which is causing the exception in the first place. As far as I can tell I get the error at the first call to any QuickPDF dll function after the first document has been generated - last Stack trace entry: at QuickPDFDLL0716.DLL.DelegateIII.Invoke(Int32 P1, Int32 P2). I'm not saying it's the QuickPDF dll that's causing the problem; heck, I wouldn't be surprised if I'm doing something wrong. I would just like to know if there is any way to solve this. Thanx in advance to anyone and everyone for all the time and effort in trying to assist me in this matter. Best regards, me Edited by that0th3rGuy - 02 Nov 10 at 2:54PM |
|
![]() |
|
that0th3rGuy ![]() Beginner ![]() ![]() Joined: 01 Sep 10 Location: South Africa Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
For what it's worth, my problem has been solved. I'm not sure if it's the most efficient, but it works, and I'm relieved.
I don't know where exactly or what exactly the problem was, but calling GC.Collect() to force collection after generating each document cleared up the issue. Hope this helps. Cheers.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store