Author Topic: Debugging in the subchild process doesn't work  (Read 3855 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Debugging in the subchild process doesn't work
« on: May 21, 2014, 10:32:05 AM »
I write the plugins for AutoCAD 2015. But it is unpossible to write the unit tests for AutoCAD plugins as the MS Visual Studio tests. Because they must work in the acad.exe process.

For solving its problem I use Gallio. It has own plugin for testing of AutoCAD plugins.

So, when I press the F5 key in Visual Studio, it runs the Gallio.Echo.exe with the necessary arguments. Then Gallio.Echo.exe launches the acad.exe and loads my tests into this process. So my IDE are connected to the Gallio.Echo.exe, but my code are working in the acad.exe.



All works fine, but I have one desire: I want in my code the working break points in the DEBUG mode. Now they are ignored.

Can I solve this problem?

P.S. I use a remote debugging, if it is important.
« Last Edit: May 21, 2014, 10:39:00 AM by Andrey Bushman »

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Debugging in the subchild process doesn't work
« Reply #1 on: May 21, 2014, 11:25:30 AM »
Have you tried using Debug->Attach To Process after everything starts up. Attach to the Acad.exe process and see if your break points work.  If not, then I'm not sure if its possible.

I tried Unit Testing with Gallio a couple of years ago but found it was just as easy using MS Unit Test Framework inside Visual Studio.  Although I admit I hardly do any unit testing with AutoCAD plug ins.
Revit 2019, AMEP 2019 64bit Win 10

Ilya

  • Guest
Re: Debugging in the subchild process doesn't work
« Reply #2 on: May 21, 2014, 11:33:02 AM »
Maybe multiple startup projects option will help, it is in the solution properties. http://msdn.microsoft.com/en-us/library/jj919165.aspx

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Debugging in the subchild process doesn't work
« Reply #3 on: May 21, 2014, 02:10:07 PM »
Have you tried using Debug->Attach To Process after everything starts up. Attach to the Acad.exe process and see if your break points work.  If not, then I'm not sure if its possible.
AutoCADs older then AutoCAD 2015 use the fibers. When AutoCAD use the fibers you can't attach to the Acad.exe process: AutoCAD and IDE don't respond. I checked it in the some AutoCAD versions in the past. AutoCAD 2011 and newer versions has FIBERWORLD (read only) and NEXTFIBERWORLD (read\write) variables. If set 1 value for NEXTFIBERWORLD and to restart AutoCAD, then attaching to the Acad.exe process will work successfully. But in case fibers is switched off AutoCAD works less stablly.

I write code for different AutoCAD versions (2009-2015). I.e. I can't switch off the fibers for the AutoCAD 2009, and 2010.

I tried Unit Testing with Gallio a couple of years ago but found it was just as easy using MS Unit Test Framework inside Visual Studio.  Although I admit I hardly do any unit testing with AutoCAD plug ins.
I don't understand you (my English is bad). Are you were disappointed about using of Gallio for AutoCAD?
« Last Edit: May 22, 2014, 01:35:20 AM by Andrey Bushman »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Debugging in the subchild process doesn't work
« Reply #4 on: May 21, 2014, 02:11:25 PM »
Maybe multiple startup projects option will help, it is in the solution properties. http://msdn.microsoft.com/en-us/library/jj919165.aspx
Thank you, I will try this in the morning.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Debugging in the subchild process doesn't work
« Reply #5 on: May 22, 2014, 01:57:56 AM »
The problem is solved.
In the Gallio settings I have set the "Attach to an existing AutoCAD process" option. Also for MS Visual Studio project (the project with my Gallio tests) I have set the usual settings like for the usual AutoCAD plugin (F5 key pressing runs the acad.exe).

So I press F5, AutoCAD has launched and I launch my BAT file - it launches the Gallio.Echo.exe with the necessary arguments. All works fine: the break points works in my Gallio tests now.

So it is possible to launch the tests via the *.BAT file only (i.e. without break points), and, if it is necessary, via the *.BAT file + MS Visual Studio (i.e. with the working break points).
« Last Edit: May 22, 2014, 02:18:59 AM by Andrey Bushman »