English

Problem: Unable to hit breakpoints when debugging ArcGIS add-in projects in Visual Studio

Description

When a breakpoint is added to an add-in project in Visual Studio, the breakpoint is not hit when debugging the program. (For more information on breakpoints, refer to Debugging Basics: Breakpoints.)

Cause

This issue occurs because the supported runtime version in the configuration (.config) file for the ArcMap add-in application does not match the targeted .NET framework of a Visual Studio project.

In the extensible markup language (XML) code of the ArcMap.exe.config file, lines 4 and 5 state the supported runtime versions for the .NET framework of a Visual Studio project. The compiler reads version 2.0 in line 5, instead of version 4.0 in line 4 as the supported runtime version because line 4 is commented.
[O-Image]

Note:
.NET 3.0 and 3.5 frameworks support runtime version 2.0 while .NET 4.0 and 4.5 support runtime version 4.0. For more information on .NET frameworks, refer to How to: Determine Which .NET Framework Versions Are Installed.

Solution or Workaround

  1. In the ArcMap.exe.config file for the add-in application, located at C:\Program Files (x86)\ArcGIS\Desktop10.3\bin, if targeting the .NET 4.0 framework, uncomment the fourth line of the code by removing the XML comment syntax (underlined in red) to support version 4.0.
    [O-Image]
  2. Add the XML comment syntax to comment the fifth line of the code since version 2.0 is not the supported version.
    [O-Image]

    Note:
    Additionally, do the same when targeting the .NET 3.5 (or under) framework.

  3. Save the file.
    Note:
    Save a copy of the file in a different folder and use it to overwrite the original file if the following error is returned, "The file cannot be saved and it may be protected."

  4. Restart Visual Studio for the changes to take effect.
  5. Debug the add-in application and the breakpoint is hit successfully.

Related Information