22 Replies Latest reply on Jul 10, 2015 8:11 AM by Lee CS Young Branched to a new discussion.

    Breakpoints for debugging an EPDM Add-in in VS 2013 Express?

    Steve Soeder

      I've written my first Add-in for EPDM and I'm having trouble debugging it.
      I've created a project that opens notepad.exe and have set it as the StartupProject.

      Notepad opens and I'm able to browse into the vault and if I right-click a file I see the context menu from my add-in. I'm able to choose the command and it even executes the first half of my code, but then it crashes notepad

       

      I've set breakpoints in my code, but the code executes and just runs right past my breakpoints

       

      I'm at the point now where I really need to be able to step through this code.

       

      I've isolated the line that is causing the problem by using strategically placed messageboxes, but I can't really troubleshoot the code any further without being able to see whats happening at run-time in Visual Studio.

        • Re: Breakpoints for debugging an EPDM Add-in in VS 2013 Express?
          Corey Scheich

          Surround the code in your method with a try catch statement.  If you don't have a try catch statement and you cause an exception then the code will exit and throw the exception to the calling application which can cause it to crash.  With a try catch you can set the breakpoint on the catch portion of the statement and then you can query the exception for more information on what is causing the crash.

            • Re: Breakpoints for debugging an EPDM Add-in in VS 2013 Express?
              Steve Soeder

              Hi Corey,


              All code has structured error handling (all my code is surrounded with various try/catch).  The issue is that breakpoints do not work.  It doesn't matter where the breakpoint is set - the program executes without stopping.

                • Re: Breakpoints for debugging an EPDM Add-in in VS 2013 Express?
                  Corey Scheich

                  There are a few ways to attach to an EPDM addin.

                  1) Register the addin in the Administration App by Right Clicking on addins and clicking Debug addin (this works best if the Addin is not currently loaded into EPDM the normal way also)

                  2) Make sure that your project's compile options is set to 'Register for COM interop'

                  3) Assuming you have already set the Application to Debug in the debug settings of your addin project hit the Run command.

                   

                  The other method

                  1) Load the addin the normal way New Addin

                  2) Brows to the local installation location C:\Users\<UserName>\appdata\local\SolidWorks\.....\Plugins\<Vault>\<GUID of addin>

                  3) Copy and paste your latest version of the addin including any .pdb files to this location (You may have to kill all applications that use EPDM including AddinSrv.exe and Explorer.exe before you will be able to replace the files)

                  4) In Visual Studio select Tools>Attach and select the process you want to debug your addin in the context of.

              • Re: Breakpoints for debugging an EPDM Add-in in VS 2013 Express?
                Steve Soeder

                Actually, after some modifications I've got it running to completion - but it still crashes notepad.  LOL.

                I added a messagebox right before the "End Sub" command which pops up letting me know that everything has executed.  Still, notepad crashes after that - I'm really not sure why - but really it's not important.

                 

                The important question remains - how to get breakpoints to work?