Skip to content

Tips for debugging extensions

Gregg Miskelly edited this page Jun 6, 2019 · 18 revisions

This page contains tips for better debugging of Concord extensions in particular, and, to some degree at least, Visual Studio all up.

Debugging extensions loaded into msvsmon.exe processes

Extensions which are either loaded into a worker process or are monitor components (components with a comment level less than 100,000) -and- a 64-bit process is being debugged will be loaded into a msvsmon.exe process.

The best way to debug these:

  1. Install the Microsoft Child Process Debugging Power Tool into Visual Studio.
  2. Configure your startup project (example: vsix.csproj) to use either native or interop debugging. If your startup project is already a VC project (.vcxproj), this is the default. If your startup project is a C# project, see below.
  3. Open 'Debug->Other Debug Targets->Child Process Debugging Settings' to configure the child process debugger.
  4. Check the checkbox to 'Enable Child Process Debugging'
  5. Set the '' action to 'Do not debug'
  6. Click the blank row in the process list, and add an entry for msvsmon.exe
  7. Set the 'Debugger Type' value to what is appropriate for your extension (ex: 'Managed (v4.6, v4.5, v4.0)' if your extension is implemented in managed code).
  8. Hit F5 to start debugging

Enabling native debugging if you have a .csproj as your startup project

If you have a .csproj as your startup project it is still sometimes useful to launch Visual Studio with native debugging enabled. There are three ways to do this:

1: Enable both managed and native debugging at the same time -- right click on your startup project and bring up project properties. Then switch to the 'Debug' tab and check the 'Enable native code debugging' checkbox. This setting is probably the best option as long as the performance of Visual Studio is acceptable in this mode.

2: Hand edit your .csproj to enable native-only debugging --

  • Right click on the startup project and unload it
  • Right click again and edit it
  • Inside a <PropertyGroup> add:
<!-- Enable native-only debugging -->
<DebugEngines>{3B476D35-A401-11D2-AAD4-00C04F990171}</DebugEngines>
  • Right click on your project and reload it + set it as the startup project

This approach is best as long as you don't need to debug any native code in Visual Studio, and you aren't frequently wanting to switch back and forth between managed-only and native-only debugging.

3: Add a dummy .vcxproj to your solution just for debugging

  • Add a new C++ console app to your solution. Make call it something like 'NativeDebugDevenv'.
  • Right click on your new project, and go to Build Dependencies->Project Dependencies, and make your new project dependent on the real startup project
  • Right click on the project again and open project properties. Go to the 'Debug' tab, and make these changes:
    • Change 'Launch' to 'Executable'
    • Change 'Executable' to the path to devenv.exe (example: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe)
    • Change 'Application arguments' to '/rootsuffix Exp'
    • Change 'Working directory' to the directory of devenv.exe
  • Make this new project your starting project

Clone this wiki locally