English

How To: Debug a Visual Basic ArcObjects ActiveX DLL application with Visual C++

Summary

To debug ArcObjects code written in Visual Basic, use either ESRI add-ins (ESRI ErrorHandler & ESRI Line Number Generator) or run their VB code in C++'s debugger.

More information about ESRI add-ins is available in the Utilities folder of ArcObjects Developer Help.

Procedure

Follow these steps to use Visual C++ to debug a Visual Basic ActiveX DLL ArcObjects application.

NOTE: Steps 1-3 apply to the Visual Basic project; the remaining steps apply to Visual C++.

  1. In the Visual Basic ActiveX DLL project, click Project > Properties > Compile.
  2. Check Create Symbolic Debug Info.
  3. Click File > Make xxxx.dll, to recompile the DLL and create the PDB file.
  4. Start VC++. Close any open workspaces.

    Warning:
    You must have Visual C++ installed in order to continue.

  5. Click File > Open and navigate to the Visual Basic class file (.cls) of your Visual Basic ActiveX DLL project.
  6. Press F5 to run the program (Build > Start Debug > Go).
  7. Click Yes to create a project.
  8. Click No; you do not want to create an EXE.
  9. Click Project > Settings > Debug.
  10. Click Category General. Set 'Executable for debug session' to ..\arcexe82\bin\ArcMap.exe.
  11. From the Category dropdown list, click Additional DLLs. Navigate to your Visual Basic DLL and click OK.
  12. Set break points in the code by going to the line where you want to start, and press F9.
  13. Press F5 to run the program.
  14. Check the box ..\arcgis\arcexe82\bin\ArcMap.exe and click OK.
  15. Press F10/F11 to step through the code.
    Note:
    When you step through the code and the debugger reaches a line that has a problem, it will not let you step over to the next line.