Remote debugging using msvsmon.exe

By Adam Nagy

I would like to debug my AddIn running on a virtual machine from my local machine. Could you list the steps I need to follow?

Solution

I think it does not really matter if you are trying to debug remotely between virtual machines or real ones, the procedure should be the same. I tested the below steps using two virtual machines: adam3596 is the one that I’m debugging from (local computer), and adam3597 is the one where the application that loads my addin is running (remote computer). Also, I’m testing with a .NET AddIn that is loaded into AutoCAD MEP 2009.

  1. We’ll be usig Windows Authentication to access one pc from the other, and for this we need to make sure that both the local and remote pc has a local account with the same name and password
     
  2. As msvsmon.exe would warn us about it as well, we need to set the local policy on both computers as follows:
    Local Security Settings > Security Settings > Local Policies > Security Options > Network access: Sharing and security model for local accounts = Classic – local users authenticate as themselves
     
    Remote_policy
     
  3. We need to copy msvsmon.exe and its related files over to the remote pc or virtual machine. Just copy the whole Remote Debugger folder to the remote machine. In case of Visual Studio 2008 you’ll find the necessary folder under
    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger
     
  4. Set up a folder that is visible from both computers and use that as your project’s build folder
     
    Remote_settings-build
  5. In some cases I had issues with attaching to the remote process – e.g. AutoCAD simply froze – but if I started the exe from Visual Studio then all worked fine. In the project’s debug settings use the remote pc and set the path of the executable you want to start
     
    Remote_settings-debug
  6. If you also want to set the working folder then it’s better to avoid using network names that are not mapped. If you want to use a network folder just right-click on the network drive in Explorer and choose Map Network Drive… and then use the mapped name, e.g. Z:\VMwareShare instead of \\.host\Shared Folders\VMwareShare
     
  7. Start msvsmon.exe on the remote pc
     
    Remote_debugging-remote
  8. Start debugging your project on the local pc and NETLOAD your addin in AutoCAD on the remote pc
     
    Remote_debugging-local

You’ll find several articles on the net about remote debugging if you simply search for msvsmon.exe.


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading