Not able to set breakpoint in visual studio
Asked Answered
F

10

14

I am using Visual Studio 2013 and I am facing a weird issue from last few days. Whenever I try to set a break point, I get an error

"The Following breakpoint cannot be set", "The breakpoint failed to bind".

I don't know what settings have changed.

Screenshot of Visual Studio error dialog

Foskett answered 10/12, 2014 at 14:17 Comment(5)
If everything else fails, maybe start a project from scratch, import all source files, and check if you have the same problem.Clasping
i check the same even i tried to open same project in other version of visual studio i.1. visual studio 2012 but its giving me same problemFoskett
Try to remove code until you have a smaller example, post that here, so others may reproduce this behaviour.Clasping
Was this local debugging or remote debugging? I had this happen with remote, and I just had to republish, and make sure the latest pdb was in the bin folder with the publish.Carolyn
Possible duplicate of Breakpoint Failed to Bind - Visual Studio 2015Wherever
K
26

I don't know if you resolved your issue but I faced the same problem and the "solution" was to change from "Release" configuration to "Debug".

Hope this Helps.

Cheers

Koger answered 22/9, 2015 at 12:42 Comment(3)
Yes, this can move you forward, but this answer doesn't get at the root cause. It also doesn't help when your bug is in the Release version only.Mouflon
I had the same problem and above resolved it for me, Thanks!Zeeba
for some reason, my target was set to release and I did not notice it. thanksTrincomalee
W
7

I used a MVC project and couldn't set any Breakpoints in the Razor-View.
All my projects were build in Debug-mode and a clean+rebuild didn't help either.
I had to remove this entry:

<configuration>
    <appSettings>
        <add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\vsinstr.exe"/>
    </appSettings>
</configuration>

in the Web.config and breakpoints worked again.


I found a related thread: Visual Studio 2013/2015 profiler adds Not publishable lines in web.config? Seems to be a Bug

Wormy answered 29/2, 2016 at 13:46 Comment(1)
Perfect! Thanks! However, I had another thing which silently interferred and that was Python tools for performance testing in VS. I had to additionally remove it too, so if anybody have this issue consider that as well.Sanfo
D
0

I had the same problem and I've fixed it by creating a new solution file to the project files.

Dartmoor answered 22/9, 2015 at 12:48 Comment(3)
Might be worth deleting the .suo file first, to see if that helps?Pharos
Actually I haven't tried to delete the suo file, it looks like a better solution.Dartmoor
I have the same problem and deleting the .suo file didn't work.Jumpy
M
0

Check your program for subtle bugs. My failure chain that caused this error was:

  1. I inadvertently put a duplicate key/value pair in App.config
  2. Code that read that key/value via the ConfigurationManager silently failed
  3. Structs returned by that code were invalid
  4. Breakpoints on any line that referenced the invalid structs failed to bind

Once I fixed Item 1, everything started working again.

Mouflon answered 19/2, 2016 at 17:11 Comment(0)
N
0

I had the same problem with Python code. Everything was ok, but

"The breakpoint failed to bind"

If the line number (where is the breakpoint set) is greater then 512, than you can't debug. I simply reorganized my code, to be earlier that part with breakpoint and magically debugging is working again...

At this link you can find a full answer (at final rows):http://pytools.codeplex.com/workitem/3007. So this is fixed in last version of Python Tools, but that version (2.2) works with VS2015 only.

Northnorthwest answered 8/9, 2016 at 14:13 Comment(0)
R
0

In my case, this was caused by a faulty merge of the .csproj contents, to be specific a ItemGroup contained a node which belonged in its own ItemGroup.

Rhiana answered 14/11, 2018 at 13:57 Comment(0)
I
0

I just encountered this myself.

To my surprise, I didn't observe I had a syntax error in a line further above.

With that one syntax error, it was causling the Studio 2019 IDE to fail in allowing me to set a break point anywhere.

So do double check if that's the case.

Inquisitor answered 25/5, 2019 at 14:19 Comment(0)
P
0

There could also be another open app that steals the "F9" shortcut.

Check your systray for open apps ;)

Piled answered 8/12, 2020 at 13:50 Comment(0)
F
0

Problem:
In VS2022 you can't set a BreakPoint on a variable declaration without an assignment.

Solution:
Set a BreakPoint on a variable declaration with an assignment or another line that is executable.

Franci answered 18/1, 2023 at 2:17 Comment(0)
E
0

I recently had the same problem, in my case it was because I had the wrong file extension on the file(s). It was added to the project and was compiling correctly, but I was unable to set a breakpoint.

Don't know if anyone else will make the same silly mistake, but if they do...

Eyecup answered 8/3, 2024 at 0:30 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.