Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ACCESS violation during invApplication.Documents.Open

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
p.rybar
1015 Views, 9 Replies

ACCESS violation during invApplication.Documents.Open

I am writing application in .NET. I have a problem with .Documents.Open(filePath). Inventor crashes with this message in log (dump included):

 

<Exception code="0xC0000005" text="ACCESS_VIOLATION" address="0x000000006C666ADF" extraInfo="module:C:\Windows\system32\MSVCR100.dll      ">
     <AccessViolation type="Read" address="0x0000000000000000" PGStatus="0x00000001" accessing_null_ptr="true"/>

 

During opening I resolve unresolved links using OnFileResolution event for files saved in different location in Vault. This error randomly occurs in 60% assy parts.

9 REPLIES 9
Message 2 of 10
santoshr0114
in reply to: p.rybar

You can try out in Debug Mode and might find out a problem.
When you say it appears in 60%, then you can surely find out in debug mode. Per se "You might loose some time".
Regards
Santosh
Message 3 of 10
p.rybar
in reply to: santoshr0114

I am actually .NET beginner, in debug mode the code terminates during Document.Open, after Inventor crashes with access violation error. I do not know how to debug inside Document.Open method.

Message 4 of 10
santoshr0114
in reply to: p.rybar

This might also be a memory problem, If you are using a Standalone application kill the Inventor process after processing few documents and initialize a new Inventor session.

 

Such kinds of error needs a proper case or scenario, or else we will be working on Gut feeling or wild guess.

 

Give a try using Documents.OpenWithOptions

Regards
Santosh
Message 5 of 10
p.rybar
in reply to: santoshr0114

Thank you for advise. OpenWithOptions does not solve the problem. I use standalone app, so it might be a memory problem, bud I need a solution. If I kill process after each lauch my script will be too slow and often this error shows even when starting from new Inventor instance. Is there some multithreading template ho run Inventor?

What do you mean by proper case or scenario?

Message 6 of 10
santoshr0114
in reply to: p.rybar

yes there will be a performance hit.

 

Basically the Inventor API is not multi threaded, so there is little advantage to write a multi-threaded application if several threads are going to perform API calls. What will happen is that each call will be queued by the COM server and processed sequentially. You can however have a multi-theaded application where a single thread access the Inventor API and other threads perform custom logic, either by using the data stored by the Inventor thread, access your custom database and so on...

(Reply from ADN Support Specialist From another post)

 

And by proper case or scenario i meant, the cause of this issue. And also i hope you are using Try....Catch blocks

Regards
Santosh
Message 7 of 10
p.rybar
in reply to: santoshr0114

Yes, I use Try Catch :),

The error ocurs during Document.Open (Inventor Call), when Inventor crashes. I am not experienced enough to read some information from Inventor dump file to recover the specific reason of the crash.

Thanks for multi threading post - but I am rather looking for some working example.

My task is to perform some tasks on 80000 files (iam, ipt, idw) saved in Vault:

1/ Download file and its children

2/ Open in Inventor -> Crash

3/ Perform task (check/restore properties, export pdf)

4/ Close Inventor

5/ Check-in to Vault

6/ Generate report

 

 

Message 8 of 10
rjay75
in reply to: p.rybar

Do some tests. On the files that crash try manually doing the process. Check the state of the files. Are they read only, an older version of Inventor files, a newer version, copied completely before opening, all dependent files accessible, setup for a different project, etc...

 

It may not be an api problem but could be a file i/o problem. Or just a corrupt file.

Message 9 of 10
p.rybar
in reply to: rjay75

I finally found the error. It occurs in file resolution of references, which were renamed inside Vault. I hope to find procedure how to load such files into Inventor.

 

 

Message 10 of 10
p.rybar
in reply to: p.rybar

I modified the file resolution code to resolve references and now it works on 95% files. In 5% the Inventor keeps crashing.

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

Post to forums  

Autodesk Design & Make Report