.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AccessViolationException for PublishExecute

7 REPLIES 7
Reply
Message 1 of 8
cvaught
600 Views, 7 Replies

AccessViolationException for PublishExecute

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();

dsdd.ReadDsd(dsdFile);

 

Publisher publisher = Application.Publisher;

PlotConfig pc = PlotConfigManager.SetCurrentConfig("DWG To PDF.pc3");

 

publisher.PublishExecute(dsdd, pc);

 

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.

 


7 REPLIES 7
Message 2 of 8
fieldguy
in reply to: cvaught

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\AutoCAD Map 3D 2011\R18.1\enu\Plotters. 

 

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.

Message 3 of 8
cvaught
in reply to: fieldguy

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.

Message 4 of 8
fieldguy
in reply to: cvaught

Are you using "backgroundplot" = 0?

 

Autodesk.Autocad.ApplicationServices.Application.SetSystemVariable("BACKGROUNDPLOT", 0) sets plot and publish to foreground.

Message 5 of 8
cvaught
in reply to: fieldguy

Yes

Message 6 of 8
cvaught
in reply to: cvaught

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?

Message 7 of 8
fieldguy
in reply to: cvaught

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).

 

Good luck!

Message 8 of 8
csludtke
in reply to: fieldguy

Did you ever resolve your issue?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost