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: 

InvalidComObjectException

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
KentKeller
801 Views, 5 Replies

InvalidComObjectException

I am having an issue with a OnSave Addin, that after working on a few drawings, it fails with the COM object that has been separated from its underlying RCW cannot be used. message.   I can't see any reason that it should be loosing its reference to the Inventor.Application.  

 

Has anyone else run into this issue with the on save events?  The odd thing is that I used the program for a long time, without any issues, but now I can only work on maybe 6 or 7 drawings before it pops up.

 

Anyone have any good tips on how to actually debug where it is loosing the reference, and why?

 

 

Kent Keller
KWiKMcad

5 REPLIES 5
Message 2 of 6
adam.nagy
in reply to: KentKeller

Hi Kent,

 

OS version? Inventor version? Is it .NET AddIn?

By OnSave AddIn you mean a translator AddIn?

 

You could keep writing to a log file to see if it's having issues with a specific function call.

 

Cheers, 



Adam Nagy
Autodesk Platform Services
Message 3 of 6
KentKeller
in reply to: adam.nagy

Hi Adam,

 

Thanks for the reply.

I am using Windows 7, and it is a .Net Addin.   This is a simple addin to write a PDF file (using pdfcreator's api) anytime a save is done on a drawing.

 

I disabled a few other addins, and it seems like it might have fixed it, but since I made that change I really haven't been opening and saving multiple files in a row.  

 

I am hoping to find time to do some testing to make sure the problem is gone, and then turn back on the addins one at a time to see which one is somehow conflicting.

Kent Keller
KWiKMcad

Message 4 of 6
KentKeller
in reply to: KentKeller

Finally got back to this.  I have pretty much every other addin disabled and it is still happening, so it idoesn't appear to be caused from other addins.  The error tells me which line it fails on, but I believe it probably fails before that.  I just don't see any reason it should

Kent Keller
KWiKMcad

Message 5 of 6
adam.nagy
in reply to: KentKeller

So what code line does it fail on?

Can you consistently reproduce the error and does it always happen on the same code line?



Adam Nagy
Autodesk Platform Services
Message 6 of 6
KentKeller
in reply to: adam.nagy

Adam,

 

For some reason it is working fine this week.  Last week I found that if while running it from the debugger, when it failed, if I unloaded the addin in Inventor, waited a while, and then reloaded it, I wouldn't get errors any more.  Other than that I didn't change anything, but it is working fine now.

 

Before it was failing on the last line in the code below

 

 Private Sub oApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles oApplicationEvents.OnSaveDocument

        Try
            ' BEFORE
            If BeforeOrAfter = EventTimingEnum.kBefore Then
                ' IDW Zoom Extents
                If DocumentObject.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then

 

 

Kent Keller
KWiKMcad

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

Post to forums  

Autodesk Design & Make Report