Reputation: 2971
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?
Upvotes: 66
Views: 102470
Reputation: 1
It may be due to code optimization option If you already in debug settings and its still not working try the following:
Open Visual Studio (2022) Right click on the Project where the class related to Select properties On the "Optimize Code" section check the Relase and UNCHECK the debug options.
Try now to hit the breakepoing.
Itzik
Upvotes: 0
Reputation: 3519
For ASP debugging:
Upvotes: 0
Reputation: 186
Ran into this issue when creating a custom web.config template on an ASP.NET MVC Application. Issue was inside the *.csproj, had to set the following PropertyGroup.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Your_Custom_Configuration|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Upvotes: 0
Reputation: 3829
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.
Upvotes: 1
Reputation: 21
This helped me
1). Build > Clean Solution and then restart Visual Studio and rebuild your project, after that debug again.
Upvotes: 2
Reputation: 301
On an ASP.NET web project, this message appeared when trying to set a breakpoint on a script that was apparently cached - the browser wasn't loading the updated version of the script (originally embedded in the HTML, then moved to a separate file).
Clearing the cache resolved it.
Upvotes: 0
Reputation: 11
If your breakpoint is in a different project and only this one is not reachable, check if "Enable Just My Code" is activated under Tools > Options > Debugging > General.
Upvotes: 1
Reputation: 405
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:
<add key="WebAPI_Address" value="http://localhost:12345/" />
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.
Upvotes: 0
Reputation: 129
If any of the top answers fail for you, restart computer, then run again in Debug mode.
Upvotes: 0
Reputation: 46219
If you are using Multiple projects, you need to make sure the step below, let project debug normally
startup project
Debug
instead of Release
Clean
your solution or projects and rebuild your projects Upvotes: 13
Reputation: 177
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.
Upvotes: 0
Reputation: 11
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
.
Upvotes: 1
Reputation: 137
Need to set the Solution Configuration to Debug mode. If it is release mode, the breakpoints will not be hit
Upvotes: -1
Reputation: 1
"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
Upvotes: 0
Reputation: 149
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
Upvotes: 1
Reputation: 59
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.
Upvotes: 0
Reputation: 1549
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.
Upvotes: 0
Reputation: 21
It worked for me:
1.Clean the Solution 2.Set Startup Project 3.Restart the Visual Studio
Upvotes: 1
Reputation: 529
Change your Project mode from Release to Debug in your Visual Studio.
Upvotes: 52