rahul.deshmukh
rahul.deshmukh

Reputation: 590

Not able to set breakpoint in visual studio

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

Upvotes: 14

Views: 34535

Answers (10)

jmoreno
jmoreno

Reputation: 13551

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...

Upvotes: 0

Jeremy Thompson
Jeremy Thompson

Reputation: 65534

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.

Upvotes: 0

Cătălin Rădoi
Cătălin Rădoi

Reputation: 1894

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

Check your systray for open apps ;)

Upvotes: 0

Tim Miltz
Tim Miltz

Reputation: 41

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.

Upvotes: 0

Josef
Josef

Reputation: 3497

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.

Upvotes: 0

Ervin Portik-Bakai
Ervin Portik-Bakai

Reputation: 1

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.

Upvotes: 0

user5997884
user5997884

Reputation: 157

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

Upvotes: 7

kismert
kismert

Reputation: 1692

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.

Upvotes: 0

Fabio Belz
Fabio Belz

Reputation: 258

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

Upvotes: 0

Dreeco
Dreeco

Reputation: 290

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

Upvotes: 26

Related Questions