Problem: Unable to hit breakpoints when debugging ArcGIS add-in projects in Visual Studio
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.)
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.
.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
- 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.
- Add the XML comment syntax to comment the fifth line of the code since version 2.0 is not the supported version.
Additionally, do the same when targeting the .NET 3.5 (or under) framework.
- Save the file.
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."
- Restart Visual Studio for the changes to take effect.
- Debug the add-in application and the breakpoint is hit successfully.
- ArcObjects Help for .NET: .NET 4.0 and 4.5 support for ArcGIS 10.2 Desktop and Engine developers
- ArcObjects Help for .NET: How to debug add-ins
- Microsoft Help: How to: Target a Version of the .NET Framework