Reasons a breakpoint will not be hit
1. You’re not in Debug config
Build configurations other than Debug, by default, have “debugging info” turned down or off, and don’t define the DEBUG or TRACE constants.
You can change this for a configuration on a project:
- Right-click the Project and go to Properties
- Go to the Build tab
- Select the Configuration you want to change
- Click ‘Advanced’ (bottom of the page)
- Change ‘Debug Info’ to ‘Full’ and perhaps turn on DEBUG and TRACE
2. The code doesn’t match
This is likely in projects where you don’t run using the Play button, like those hosted in IIS or by an external tool. Make sure you’ve shut down any old running instances (check Task Manager), then rebuild, and start the processes from scratch. After you re-attach, the problem may be gone.
If not, you can get really clean by either restarting the machine, or: Closing all Visual Studio processes, deleting all bin and obj, and restarting IIS.
In branched code, make sure that you are debugging the same branch you built! Make sure your worker processes are running the branch you think they are!