7 Replies Latest reply on Aug 5, 2014 2:55 PM by Davide Centomo

    Add-In fails when with two EPDM Explorer windows open

    Mike Gann

      I just deployed my first add-in written in VB.net 2010. Its a simple add-in that responds to a button on the data card. When the button is clicked the add-in reads variables off the data card to build a PDF file name, then opens the PDF.

       

      This all works fine the first time you open a EPDM explorer window. But if I close the first explorer window and open another Explrer window or open a second explorer windor then the  I get a Solidworks Enterprise PDM error message box with the text:

       

      Call to method 'OnCmd' in add-in 'xxxx', writen by company 'yyyy' failed. Error code = 0x08001010E (The application called an initerface that was marshalled for a different thread).

       

      Add-in error message.jpg

      So it seems like there is an issue if the add-in is called a second time by a different inistance of the EPDM explorer interface.

       

      The code is attached if you would like to look at it.

       

       

      Once again, any help is appreciated!

       

      Thanks,

       

      Mike

        • Re: Add-In fails when with two EPDM Explorer windows open
          Artem Taturevych

          Do you know what exactly the line which is causing the issue?

            • Re: Add-In fails when with two EPDM Explorer windows open
              Mike Gann

              No I don't. But I don't think there it is an actual error in the Add-in.

               

              When debugging the add-in in Visual Studio using Notepad as the start up application, I can open two instances of Notopad and the add-in functions normally in both at the same time without any errors.

               

              If I deploy the Add-in and then try to access it in the EPDM explorer interface, then I have the problem:

               

              The add-in works perfectly the first time I open a EPDM explorer window.

               

              Now, if I close this explorer window and then open a new explorer window and access the vault, then I get the error message as soon as the add in rins.

               

              The same is true if I open an EPDM explorer window the first time the add-in will work. If I leave this first explorer window open and open a second explorer window, I'll get the error message in the second explorer window as soon as the add-in runs. The add-in will continue to work normally in the first explaorer window, until that window is closed.

               

              Thanks,

               

              Mike

            • Re: Add-In fails when with two EPDM Explorer windows open
              Jim Sculley

              Read the API documentation for IEdmEnumeratorVariable.  Pay special attention to the text in the bright yellow box.

               

              Jim S.

                • Re: Add-In fails when with two EPDM Explorer windows open
                  Mike Gann

                  Hi Jim -

                   

                  Thanks for the tip. I changed IEdmEnumeratorVariable5 to IEdmEnumeratorVariable 8 and added the call to IEdmEnumeratorVariable8::CloseFile. This line was added right after the call to get the last variable from the data card.

                   

                  Unfortunatly I still have the same problem.

                   

                  Best regards,

                   

                  Mike

                    • Re: Add-In fails when with two EPDM Explorer windows open
                      Jim Sculley

                      Try to distill the code down to the smallest example possible that still exhibits the behavior.  Preferably something that doesn't rely on the specifics of your vault setup.  That will make it easier for others to verify the problem and in the process of simplifying it, you may stumble across the answer yourself.

                       

                      Jim S.

                        • Re: Add-In fails when with two EPDM Explorer windows open
                          Mike Gann

                          I know it's been awhile, but I wanted to post the final solution. I appreciated all of the solutions suggested, but the problem turned out to be my development environment. This was my first try at setting up visual basic for the EPDM add-ins and I was following someones posted manual procedure on how to set things up. After I downloaded the EPDM SDK for Visual basic and recompiled my add-in this problem went away.

                           

                          Thanks,

                           

                          MIke

                            • Re: Add-In fails when with two EPDM Explorer windows open
                              Davide Centomo

                              Hi Mike, did you found what was the difference introduced by the SDK? Probably it was because the usage of a vault instance created on the context of a different thread. Casting the vault from the arguments of the OnCmd method you should avoid this condition.

                              About the usage of multiple Explorer windows I catch this SPR 453269 - "COM exception (RPC_E_SERVER_DIED_DNE) when running multiple instance of explorer and one is closed" that I suppose will interest many other developers.