Problem debugging SlicerVirtualReality extension

Hello,

I need help with debugging process of the SlicerVirtualReality extension. First things first… what I managed to do:

  1. Cloned 3D Slicer repo and built it (debug).
  2. Tried running 3D Slicer which was ok.
  3. Tried to debug it and it was also ok.
  4. Then I cloned the SlicerVirtualReality repo and built it (debug).
  5. Tried SlicerWithSlicerVirtualReality.exe and it works fine.
  6. Created a BAT file containing this: D:\Slicer3D_git\build_debug\Slicer-build\Slicer.exe --VisualStudio --launcher-no-splash --launcher-additional-settings D:/Slicer_plugins/SlicerVirtualReality/build_debug/inner-build/AdditionalLauncherSettings.ini D:/Slicer_plugins/SlicerVirtualReality/build_debug/inner-build/SlicerVirtualReality.sln
  7. Run the BAT file, VS project opens, set the slicer-real.exe path as a command in debugging project settings, start project debug which opens up the 3D Slicer app BUT without the SlicerVirtualReality extension present.

Can anyone guess what am I missing? Maybe something in CMake?

I was following this official tutorial: C++ debugging on Windows — 3D Slicer documentation
I also tried this forum post response: Debug Slicer and SlicerRT Together - #6 by cpinter

I searched on this forum and found several posts more or less talking about extensions, debugging etc., but non of them yielded a correct solution.

Do you see anything in Application Settings / Modules / Additional module paths?

If not, maybe you need to add here the qt-loadable-modules/Debug folder.

Is there any error in the Python console or the Error log right after startup?

1 Like

That’s how the 3D Slicer settings looks like when I open it up using SlicerWithSlicerVirtualReality.exe file. You can see that the extension is there (icons on top left corner + Virtual Reality module which is selected) but no modules folders added.

There is also one error in the Python console.

Starting the debug session in VS project (SlicerVIrtualReality) opens up 3D Slicer with the same python console error but without the extension

Python error
QWindowsWindow::setGeometry: Unable to set geometry 675x623+2543+312 (frame: 691x662+2535+281) on QWidgetWindow/“ctkSettingsDialogWindow” on “\.\DISPLAY2”. Resulting geometry: 675x633+2543+312 (frame: 691x672+2535+281) margins: 8, 31, 8, 8 minimum size: 675x623 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=691,662 maxtrack=0,0)

BUT…

I tried your advice to add the Debug folder and it worked actually. Thanks a lot!

Even a second problem with breakpoints not being able to be hit due to no symbols loaded for extensions code is gone.

It’s weird a bit since I tried it already once and it didn’t work the first time. I added it based on following extension building tutorial (option: it is build - Option B)
https://slicer.readthedocs.io/en/latest/developer_guide/extensions.html#windows

This error also appears for me using the latest revisions.

That executable adds the necessary paths to include the extension. However, when you debug you need to use the SlicerApp-real.exe, which is not a launcher, so it does not add any paths. So you need to make sure the application loads the extension.

You do use the launcher when you start Visual Studio, but that is the basic Slicer launcher. Maybe you can use the SlicerWithSlicerVirtualReality.exe for starting VS and then not add the module directories, bue I haven’t tried that personally.