Unhandled Exception in API method DrawingDocument.SaveAs: Inconsistent Memory

Unhandled Exception in API method DrawingDocument.SaveAs: Inconsistent Memory

patrick.omalley2BXT6
Participant Participant
1,366 Views
2 Replies
Message 1 of 3

Unhandled Exception in API method DrawingDocument.SaveAs: Inconsistent Memory

patrick.omalley2BXT6
Participant
Participant

Greetings!

 

Intro: I'm running into an issue with some unexpected API behavior that causes Inventor 2018.3 to crash in a batch processing application I'm developing.  While I figure out a work-around, I wanted to throw this issue out there to the community to see if anyone had any ideas on the root cause and hopefully get some engagement from Autodesk Inventor QA (since the "Bug Alert" instructs one to "Please report this to Inventor QA").  And for any Autodesk QA tuning in, this behavior has generated a slew of error reports, most notably CER_183470955...

 

Issue/Behavior:

After copying drawing sheet information from a legacy drawing into a new drawing, and deleting the legacy drawing, Inventor throws a "Bug Alert!" in the middle of executing the DrawingDocument.SaveAs method call--where the .SaveAs method is attempting to save the new file with the exact same name as the deleted file. API error.png

 

NOTE 1: I have a version of this script already in production that executes this program flow without issue every time, but it was only designed to update one legacy drawing file at a time. In addition, I can execute the current batch processing version of the script on some files and it works repeatably without issue--so I know the program flow is capable of working.

 

NOTE 2: You can see from the picture below that the .SaveAs method seems to create a temporary file for the new document undergoing the initial document save (~0002_703(29_test).dwg.2152.newVer.tmp) but prior to Inventor crashing.File directory-temp created.png

 (NOTE 3: the other temporary file appearing directly above belongs to the 0002_702(28_test).dwg file, which is open. I have tried closing each file individually at the end of the loop and leaving them open in the session memory, but the result is the same: Inventor crashes. So I don't have reason to believe that part of the implementation has any affect on the outcome.)

 

Issue Details: In a nutshell, all i'm trying to do is:

  1.  Take a list of user-selected files that are legacy drawings (not to current standards)
  2.  Loop through each legacy drawing file and:
    1. Create a brand new file based on the current version of the drawing template (but has nothing on the default drawing sheet)
    2. Copy each legacy drawing sheet into the "new" drawing document
    3. Delete the legacy information that no longer applies (revision clouds, certain sketch symbols, old AutoCAD blocks, etc.)
    4. Delete the legacy document object (by using the FileManager object, since the Documents collection does not have a .Delete method available).
    5. Close the legacy document object (NOTE: the Inventor API forces the ".DeleteFile" method implementation, through the FileManager object to occur before  the Document.Close method is implemented--which is what, theoretically, should "kick-out" any remaining session memory reference to the document that was deleted. Trying to execute the .Close method before the .DeleteFile method is futile whereas an automation error exception is throw and Inventor crashes.)
    6. Save the new document with the same full file name as the legacy file that was deleted.
    7. Next legacy file.

Again, this program flow works without issue when applied to a single document.  I have also run tests on certain batches of legacy drawings that execute repeatably and without issue. To compound things, there was a time within the last month where the current development version of this application was tested on these same files and worked without issue.

 

For reference:

  1. All files are able to be opened in Inventor 2018.3 (thus are migrated) and have no unresolved references, etc.
  2. The applications are being prototype using the VBA language & development environment.

Specific test files may be available upon request to the right person (Inventor QA).

 

Let me know if anyone has any ideas as to what might be the root cause of this issue and that I could test for.

 

Thanks!

0 Likes
1,367 Views
2 Replies
Replies (2)
Message 2 of 3

johnsonshiue
Community Manager
Community Manager

Hi Patrick,

 

Like I mentioned in the reply to the message, we will need to see the reproducible steps and the files. Would you be able to share those here or send them to us directly ([email protected])?

Many thanks!

 



Johnson Shiue ([email protected])
Software Test Engineer
0 Likes
Message 3 of 3

patrick.omalley2BXT6
Participant
Participant

Thanks for the reply Johnson, for now, I will send the test files directly to you and then when we figure out the root cause I'll post a results summary.

0 Likes