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

acadDB.SaveAs() AccessViolationException

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
442 Views, 2 Replies

acadDB.SaveAs() AccessViolationException

While processing the drawing files in batch mode, the below given statement raise 'AccessViolationException' [Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]. But the same statement works for spare Drawing files. How to fix this issue?

 

acadDB.SaveAs(outputPath & "\" & dwgName.ToString & ".dwg", True, DwgVersion.Current, Nothing)

Tags (2)
2 REPLIES 2
Message 2 of 3
Littlerubarb
in reply to: Anonymous

Please elaborate, the code looks correct but does it work on some files or none?

Message 3 of 3
Anonymous
in reply to: Anonymous

Hi,

 

I assume you read/write drawing using ReadDwgFile.
Before saveas command check open drawing file already close and released in memory.

 

I have the same issue and I sove this using below code.
Hope this will help.

 

If this code not help, please explain your issue little more.

 

code:

 

  string tempFileName = System.IO.Path.GetTempFileName();
  acadDB.CloseInput(true);
  
  // save as temp file
  acadDB.SaveAs(tempFileName, DwgVersion.Current);

   // dispose the database
  // now replace
  System.IO.File.Copy(tempFileName, File_name_path, true);
  // and erase the temp file
  System.IO.File.Delete(tempFileName);

 

Thanks,

thenndral

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