[英]Breakpoints set but not yet bound in Visual Studio
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.运行 Visual Studio Community 2017。创建了一个 WebAPI 项目,里面有一个 controller class,有一些基本的东西,但是当我 go 在调试模式下运行时,我的断点出现以下错误,我没有最模糊的想法为什么。
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.我在这里和那里看到了一些答案,但它们没有帮助,或者它们是关于 Visual Studio Code 的,我绝对不会使用它。
I found this , but it doesn't tell me what to do about my problem.我找到了这个,但它没有告诉我如何解决我的问题。 How do I fix this issue?我该如何解决这个问题?
Change your Project mode from Release to Debug in your Visual Studio.在 Visual Studio 中将项目模式从发布更改为调试。
尝试将您的 web 项目设置为默认Startup Project 。
If you are using Multiple projects, you need to make sure the step below, let project debug normally如果您使用的是多个项目,则需要确保以下步骤,让项目正常调试
startup project
确认要调试的项目是默认项目,否则设置为startup project
Debug
instead of Release
确认您的项目模式是Debug
而不是Release
Clean
your solution or projects and rebuild your projects Clean
您的解决方案或项目并重建您的项目只需清除解决方案并重新启动 Visual Studio。
Clean the solution:清洁溶液:
Build -> Clean [solution name]构建 -> 清理 [解决方案名称]
Select Debug instead of Release...And it might work..选择调试而不是发布...它可能会工作..
This helped me这对我有帮助
1). 1). Build > Clean Solution and then restart Visual Studio and rebuild your project, after that debug again. Build > Clean Solution 然后重新启动 Visual Studio 并重建您的项目,然后再次调试。
https://learn.microsoft.com/en-us/answers/questions/265772/visual-studio-debugging-breakpoint-set-but-yet-bou.html https://learn.microsoft.com/en-us/answers/questions/265772/visual-studio-debugging-breakpoint-set-but-yet-bou.html
It worked for me:它对我有用:
1.Clean the Solution 2.Set Startup Project 3.Restart the Visual Studio 1.清理解决方案 2.设置启动项目 3.重新启动 Visual Studio
如果您的 Web API 项目在 IIS 中运行,并且/或者在终端上启动(例如,如果您使用的是 .net Core),并且您需要将调试器附加到已经运行的进程,请确保 Visual Studio 以管理员身份运行,除非它不允许附加到进程。
If you have a typo in your Javascript, the breakpoint will not work.如果您的 Javascript 中有错字,断点将不起作用。 I used "<>" instead of "!=" and when I fixed it, the breakpoint worked again.我使用“<>”而不是“!=”,当我修复它时,断点再次起作用。
当您在解决方案运行时尝试在“javascript”文件中放置断点时,将显示“断点不会被命中”警告。对此的解决方案是,停止调试并在 javascript 中放置断点并再次运行项目
Please try following steps to troubleshoot:请尝试以下步骤进行故障排除:
1). 1)。 Build > Clean Solution and then restart Visual Studio and rebuild your project, after that debug again. Build > Clean Solution,然后重新启动 Visual Studio 并重建您的项目,然后再次调试。
2). 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.请转到您的解决方案文件夹并删除(或重命名)“obj”、“bin”和隐藏的“.vs”文件夹,重新启动 Visual Studio,然后重新构建您的解决方案。
3). 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.检查您是否选择了“调试”模式,如果您在此解决方案中有许多其他项目,请确保您已为相应项目设置了“设置为启动项目”。
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
.在我的场景中,我将它从http://localhost/productname.web
更改为http://localhost:56260
。
做了一切,但问题仍然存在,当我清除浏览器的缓存和 Windows/Microsoft .NET/Framework 和 Framework64 中的临时 ASP .Net Files 文件夹时,终于解决了。
如果任何最重要的答案对您来说都失败,请重新启动计算机,然后在调试模式下再次运行。
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.以下是我们在某些情况下的情况:我们在 Visual Studio 中有一个 ASP.NET 解决方案,它有两个项目:一个用于 API,一个用于网站。 It's got a mix of jQuery, JavaScript, and C# code.它混合了 jQuery、JavaScript 和 C# 代码。 We were able to debug JavaScript & jQuery code, but NOT the C# code.我们能够调试 JavaScript 和 jQuery 代码,但不能调试 C# 代码。 That is when we were getting the dreadful "Breakpoints set but not yet bound in Visual Studio" error.那是我们得到可怕的“断点设置但尚未在 Visual Studio 中绑定”错误的时候。 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.长话短说,我们必须更新 web.config 文件以指向我机器上的正确 localhost 端口,而不是服务器。
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.需要注意的一点是,与 API 项目启动时的 localhost 地址相比,我们的网站 localhost 地址是不同的。 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.为了解决这个问题,他必须使用不同的浏览器启动 API 项目,然后获得一个唯一的端口号。 I don't know why, maybe it depends on the environment.不知道为什么,可能跟环境有关。
vs might be in release mode. vs 可能处于发布模式。 just change it to debug mode只需将其更改为调试模式
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.如果您的断点在不同的项目中并且只有这个无法访问,请检查“工具”>“选项”>“调试”>“常规”下的“仅启用我的代码”是否已激活。
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).在 ASP.NET web 项目中,当尝试在显然缓存的脚本上设置断点时出现此消息 - 浏览器未加载脚本的更新版本(最初嵌入在 HTML 中,然后移动到单独的文件)。
Clearing the cache resolved it.清除缓存解决了它。
Ran into this issue when creating a custom web.config template on an ASP.NET MVC Application.在 ASP.NET MVC 应用程序上创建自定义 web.config 模板时遇到此问题。 Issue was inside the *.csproj, had to set the following PropertyGroup.问题出在 *.csproj 中,必须设置以下 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.