Breakpoints set but not yet bound in Visual Studio

C#Visual Studio

C# Problem Overview


Running Visual Studio Community 2017. Created a WebAPI project, have a controller class in there, with some basic stuff, but when I go to run in debug mode, I get the following error on my breakpoints, and I haven't the foggiest idea why.

The breakpoint will not currently be hit. Breakpoints set but not yet bound.

I've seen a few answers here and there, but they don't help, or they're about Visual Studio Code, which I am definitely not using.

I found this, but it doesn't tell me what to do about my problem. How do I fix this issue?

C# Solutions


Solution 1 - C#

Change your Project mode from Release to Debug in your Visual Studio.

Debug Mode

Solution 2 - C#

Try setting your web project as default Startup Project.

Solution 3 - C#

If you are using Multiple projects, you need to make sure the step below, let project debug normally

  1. Confirm the project which you want to debug is a default project, otherwise setting it as startup project enter image description here
  2. Confirm your project mode is Debug instead of Releaseenter image description here
  3. Clean your solution or projects and rebuild your projects enter image description here
  4. Restart & Running your Current project.

Solution 4 - C#

Just clear the solution and re-start Visual Studio.

Solution 5 - C#

Clean the solution:

Build -> Clean [solution name]

Solution 6 - C#

Select Debug instead of Release...And it might work..

Open this link to see the step

Solution 7 - C#

Usually it can happen even if all the configurations in project are OK, so do the following.

Right Click to Solution and under Configuration change Release to Debug

enter image description here

Solution 8 - C#

It worked for me:

1.Clean the Solution 2.Set Startup Project 3.Restart the Visual Studio

Solution 9 - C#

If your Web API project is running in IIS, and / or was launched on a terminal (e.g. if you are using .net Core), and that you are in a case that you need to attach the debugger to an already running process, make sure Visual Studio was run as an administrator, unless it won't be allowed to attach to the process.

Solution 10 - C#

If you have a typo in your Javascript, the breakpoint will not work. I used "<>" instead of "!=" and when I fixed it, the breakpoint worked again.

Solution 11 - C#

"Break point will not be hit" warning will show, when you try to put a break point in "javascript" file while the solution is running .Solution to this is , stop debugging and put break point in the javascript and run the project again

Solution 12 - C#

Please try following steps to troubleshoot:

1). Build > Clean Solution and then restart Visual Studio and rebuild your project, after that debug again.

2). Please go to your solution folder and delete(or rename) the “obj”, “bin” and the hidden “.vs” folder, restart Visual Studio and then rebuild your solution.

3). Check if you have chosen the “Debug” mode and if you have many other projects in this solution, make sure you have set the “Set as Startup Project” for the corresponding project.

Solution 13 - C#

Need to set the Solution Configuration to Debug mode. If it is release mode, the breakpoints will not be hit

enter image description here

Solution 14 - C#

I had exactly the same message even though I tried most of the suggestions here. What worked in the end was to change the "Project Url" under "Properties" of the website project. In my scenario I changed it from http://localhost/productname.web to http://localhost:56260.

Solution 15 - C#

Did everything but the issue was there, got it resolved finally when I cleared the cache of browser and the temporary ASP .Net Files folder in Windows/Microsoft .NET/Framework and Framework64.

Solution 16 - C#

If any of the top answers fail for you, restart computer, then run again in Debug mode.

Solution 17 - C#

My team was able to resolve this issue today and I wanted to share the solution because it is unique from everything else I have read online. I hope it helps someone out there.

Here's our situation for some context: We have an ASP.NET solution in Visual Studio that has two projects: one for the API and one for the website. It's got a mix of jQuery, JavaScript, and C# code. We were able to debug JavaScript & jQuery code, but NOT the C# code. That is when we were getting the dreadful "Breakpoints set but not yet bound in Visual Studio" error. To make a long story short, we had to update a web.config file to point to the correct localhost port on my machine instead of the server.

This is what we had to do to get it working:

  1. Open an instance (we will call this "the first instance") of Visual Studio (we will call it VS from now on) with the website project set as the Startup Project.
  2. Open a second instance of Visual Studio with the API project set as the Startup Project. Click the Start button to open the web browser. You may get a server error (I did) but that's okay. Copy the full address in the address bar (for example http://localhost:12345/).
  3. Back to the first instance of VS, we had to edit the web.config file for the website project to point to the address we copied above. This value was in the configuration section under appSettings. There was a key in there that looked like this once we changed it:
    <add key="WebAPI_Address" value="http://localhost:12345/" />
  1. Once this information is saved, we had to Start the API project in the second instance of VS, and then go to the first instance of VS and Start the website project there.

I hope I didn't leave anything out. One thing to note is, the website localhost address is different for us compared to the localhost address when the API project was launched. One of our developers got the same port number for both. To resolve that issue, he had to Start the API project using a different browser, and then he got a unique port number. I don't know why, maybe it depends on the environment.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNovaDevView Question on Stackoverflow
Solution 1 - C#Sandeep Kumar SinghView Answer on Stackoverflow
Solution 2 - C#k1devView Answer on Stackoverflow
Solution 3 - C#D-ShihView Answer on Stackoverflow
Solution 4 - C#TowhidView Answer on Stackoverflow
Solution 5 - C#shdrView Answer on Stackoverflow
Solution 6 - C#Deekshith ShekarView Answer on Stackoverflow
Solution 7 - C#RubenView Answer on Stackoverflow
Solution 8 - C#Ali HamzaView Answer on Stackoverflow
Solution 9 - C#kall2solliesView Answer on Stackoverflow
Solution 10 - C#Diego QuirosView Answer on Stackoverflow
Solution 11 - C#Rajeesh RView Answer on Stackoverflow
Solution 12 - C#Abdulhakim ZeinuView Answer on Stackoverflow
Solution 13 - C#HariView Answer on Stackoverflow
Solution 14 - C#MartinView Answer on Stackoverflow
Solution 15 - C#FarrukhMalikView Answer on Stackoverflow
Solution 16 - C#Rares-Mihai ChelariuView Answer on Stackoverflow
Solution 17 - C#CaptainGenesisXView Answer on Stackoverflow