Error Message when Closing Inventor 2017

Error Message when Closing Inventor 2017

Martin-Winkler-Consulting
Advisor Advisor
474 Views
4 Replies
Message 1 of 5

Error Message when Closing Inventor 2017

Martin-Winkler-Consulting
Advisor
Advisor

Hi,

i wrote some Tools as AddIn in VB.Net.

With Inventor 2016 they work fine.

In Inventor 2017 i get an error message that a COM object is disconnected from the RCW and could not be used any longer.

 

Failure.jpg

This Error is initialized in the Closing section of the AddIn after closing InventorApp.

 

 

 ''' <summary>
    ''' Do cleanups in it such as releasing COM objects or forcing the GC to Collect when necessary.
    ''' </summary>


    Public Sub Deactivate() Implements ApplicationAddInServer.Deactivate
        ' Add more cleanup work below if necessary, e.g. remove even handlers, flush and close log files, etc.


        ' Release COM objects
        '

        ' Add more FinalReleaseComObject() calls for COM objects you know, e.g.
        'if (comObj != null) Marshal.FinalReleaseComObject(comObj);

        ' Release the COM objects maintained by InventorNetAddinWizard.
        For Each button As InventorButton In AddinGlobal.ButtonList
            If button.ButtonDef IsNot Nothing Then
                Marshal.FinalReleaseComObject(button.ButtonDef)
            End If
        Next

        'Menüleisten schliessen
        If AddinGlobal.RibbonPanelPart IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.RibbonPanelPart)
        End If

        If AddinGlobal.RibbonPanelAssembly IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.RibbonPanelAssembly)
        End If

        If AddinGlobal.RibbonPanelDrawing IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.RibbonPanelDrawing)
        End If

        If AddinGlobal.RibbonPanel3DCSBrowser IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.RibbonPanel3DCSBrowser)
        End If


        'Closing Inventor
        If AddinGlobal.InventorApp IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.InventorApp)
        End If

 

      End Sub

Any idea how i can recognize which COM Object creates the error message?

When i have a look at the debugger there is no COM Object openend at this time.

 

Best Regards Martin

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
475 Views
4 Replies
Replies (4)
Message 2 of 5

Martin-Winkler-Consulting
Advisor
Advisor

I read in this post that there is a new Tutorial Manager in Inventor 2017.3

In the error message the Tutorial Manager is also contained. Could there be context?

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 3 of 5

 Hi, after hard work i could figure out that this code cause the problem:

 

'Closing Inventor
        If AddinGlobal.InventorApp IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.InventorApp)
        End If

So when i delete it, the error message does not come any longer.

It's only in Inventor 2017!.

 

I am not sure wether this is a safe way and could cause other problems.

Is the FinalRelease of InventorApplication necessary?

 

I am excited about your opinion.

 

Martin

 

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 4 of 5

b_sharanraj
Advocate
Advocate

hi @Martin-Winkler-Consulting

 

Even i got the Same Kind of Error message "COM object is disconnected from the RCW and could not be used any longer."

 

Even I figured out the exact scenario as it happens only while I'm Feeding some Text Parameters from my External App to Inventor 2017.

 

I have been reported and got a positive feedback as it'll be fixed ASAP 🙂

 

https://forums.autodesk.com/t5/inventor-customization/inventor-2017-crashing-while-accessing-from-ex...

Regards

B.Sharan Raj

0 Likes
Message 5 of 5

Martin-Winkler-Consulting
Advisor
Advisor

Hi @ B.Sharan Raj

thank you for your answer.

I hope Autdesk will fix it soon.

In my case an Addin for translation which builds ressources for each language in my External App could be the reason, but i'am not shure.

 

Best Regards

Martin Winkler

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes