C# – Visual Studio C# debugger – the breakpoint will not currently be hit

breakpointscdebuggingvisual studio 2012

I know that this question has been asked several times, and many people here have suggested different answers. Though none of them are working for me.

I created a Windows Forms application with Visual Studio and .NET framework 4.0 and added a breakpoint. However, when I debug the application, an exclamation mark appears on the breakpoint and it says..

The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: conditional compilation or compiler optimizations.

I have tried out several suggested solutions

  • Cleaned the project
  • Deleted the pdb
  • Checked the configuration and ensured that it is debug
  • Set the debug configuration from "x86" to "Any CPU"
  • Tried creating project from scratch
  • Tried re-installing .NET framework
  • Removed temporary ASP.NET files

However, none of them seems to be working. I was able to debug my projects with breakpoints before and for some reason, something happened and I am not able to debug the projects any more. What should I look out for or fix to resolve this issue?

Best Answer

Probably your breakpoint is in a project which is not dependent on the "startup project". Implicitly these projects are not compiled on Run (button F5).

Go to: menu ToolsOptionsProject and SolutionsBuild and Run → uncheck first check box (only build startup projects and dependencies on Run).