ACCESS violation during invApplication.Documents.Open

ACCESS violation during invApplication.Documents.Open

Anonymous
Not applicable
1,330 Views
9 Replies
Message 1 of 10

ACCESS violation during invApplication.Documents.Open

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (1)
1,331 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
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".
0 Likes
Message 3 of 10

Anonymous
Not applicable

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.

0 Likes
Message 4 of 10

Anonymous
Not applicable

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

0 Likes
Message 5 of 10

Anonymous
Not applicable

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?

0 Likes
Message 6 of 10

Anonymous
Not applicable

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

0 Likes
Message 7 of 10

Anonymous
Not applicable

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

 

 

0 Likes
Message 8 of 10

rjay75
Collaborator
Collaborator

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.

0 Likes
Message 9 of 10

Anonymous
Not applicable

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.

 

 

0 Likes
Message 10 of 10

Anonymous
Not applicable
Accepted solution
I modified the file resolution code to resolve references and now it works on 95% files. In 5% the Inventor keeps crashing.
0 Likes