I have created a batch publishing plugin that is causing the following error:
AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
The execption occurs at PublishExecute in the following abbreviated code snippet:
DsdData dsdd = newDsdData();
Publisher publisher = Application.Publisher;
PlotConfig pc = PlotConfigManager.SetCurrentConfig("DWG To PDF.pc3");
This error does NOT occur in my development environment - AutoCAD 2010, Window XP, 32-bit. It does occur on a customers machine - AutoCAD 2011, Win7, 64-bit.
Any ideas on what I need to change to solve this problem? Any help would be greatly appreciated.
I have never used publish or sheet sets in .net. You can read more >>here<<. If you add a try/catch you should get more detailed exception information.
My 1st guess would be access to the pc3 file. Check to make the sure the client has access to (example is Map 3d 2011 on Win 7 Pro x64) C:\Users\"username"\AppData\Roaming\Autodesk\AutoC
If you wanted to try moving the pc3 file to a folder you know the user has full access to, you can add a shortcut to the path you want to use in the folder above. In other words, autocad will find PC3 files in an alternate path if a shortcut to that path is found in the folder specified in Options->Files->Printer Support File Path->Printer Configuration Search Path. You have to do the same with the associated PMP file. We use this approach but we also rename the PC3 & PMP files.
I should have mentioned that the error is not constant. Sometimes the publishing works and no error is thrown. I would say that the error occurs greater than 50% of the time. Since it works sometimes I assume that would mean it isn't likely to be related to the pc3 file but I will investigate it.
Are you using "backgroundplot" = 0?
I have determined that this error only occurs when I netload the plugin dll into AutoCAD from a standalong application that is connected to AutoCAD. If I manually open AutoCAD, netload the plugin, the PublishExecute works without an issue. What is affected by the fact that I am controlling AutoCAD from a standalong application?
You will have to search here. External access uses COM and internal access uses .NET. I have not created any standalone exe that accesses autocad. There is a link >>here<<.
There are several discussions in this forum on standalone vs internal, com vs. net, exe and dll, etc.
The problem is mixing managed api (internal) like acmgd, and acdmgd with external (com).
Access a broad range of knowledge to help get the most out of your products and services.