后面代码中的断点未命中
我猜是常见问题,但到目前为止还没有解决方案有效:
我的断点(asp.net 2.0)在“后端”程序集中很好地命中,但没有 在后面的代码中。
我什至可以看到 <% Response.CacheControl="无缓存"; %>我的 asp.net 主文件中的行被击中 但仍然不是后面的代码。
我使用的是 VS 2005,Windows 7 32 位。 知道我还能检查什么吗?
common problem I guess, but no solution has worked so far:
my breakpoints (asp.net 2.0) get hit nicely in "backend" assemblies but not
in the code behind.
i can even see the
<% Response.CacheControl="no-cache"; %> line being hit in my asp.net master file
but still not the code behind.
I'm using VS 2005, windows 7 32 bit.
Any idea what else could I check?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您的代码文件比正在运行的编译版本更新(在 Web 服务器上,无论是 IIS 还是开发服务器),则不会命中断点(红色圆圈将是空心的)。
尝试进行清理/重建,看看是否有效。
编辑:
我刚刚注意到你上次评论中的一些内容;你说你正在附加到asp.net进程。您要附加到哪个进程?应该是w3wp.exe。
If your code file is newer than the compiled version that is being run against (on the web server, whether it be IIS or the dev server), breakpoints will not be hit (the red circles will be hollow).
Try doing a clean / rebuild and see if that works.
EDIT:
I just noticed something in your last comment; you said you are attaching to the asp.net process. To which process are you attaching? It should be w3wp.exe.
我的问题最终是我为项目创建了一个新配置,但项目上没有为其设置任何调试属性。所以这就是我必须做的:
My problem ended up being that I'd created a new configuration for the project, but that none of the debug properties on the project were set for it. So this is what I had to do:
我猜想加载页面符号时出现问题,因此未命中断点,
请尝试此操作
1 - 在 Visual Studio 中进行调试时,单击“调试”>“窗口>模块。 IDE 将停靠一个模块窗口,显示已为您的项目加载的所有模块。
2 - 查找项目的 DLL,并检查它的符号状态。
3 - 如果显示“符号已加载”,那么您就成功了。如果显示类似“无法找到或打开 PDB 文件”之类的信息,请右键单击您的模块,选择“加载符号”,然后浏览到 PDB 的路径。
4 - 我发现有时需要
停止调试器
关闭 IDE
关闭托管应用程序
删除 obj 和 bin 文件夹
重新启动 IDE
重建项目
再次浏览“模块”窗口 浏览
到 PDB 文件的位置后,符号状态应更改为符号已加载,您现在应该能够在代码行中设置和捕获断点。
希望有帮助!
答案来源
I'm guess there is a problem in loading the symbols for the page, and hence the breakpoint is not hitting,
try this
1 - While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
2 - Look for your project's DLL, and check the Symbol Status for it.
3 - If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
4 - I've found that it's sometimes necessary to
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
hope it helps !
Answer source
啊。就我而言,我已在 IIS 中映射了正确的文件夹,但应用程序是在 IIS Express 上设置的。
因此,当我访问 URL 时,会加载正确的程序集,但应用程序附加到从未获得任何点击的 IIS Express 版本。
Ugh. In my case I had mapped the right folder in IIS, but the application was set on IIS Express.
So the correct assemblies where loaded when I went to the URL, but the application was attached to a IIS Express version that never got any hits.
就我而言,我从 Git 更新了我的存储库,项目从本地 IIS 更改为 IIS Express(项目 > 属性 > Web 选项卡)。这不知何故弄乱了我的配置,我无法调试。
In my case I updated my repo from Git and the Project changed from Local IIS to IIS Express (Project > Properties > Web tab). This somehow messed up my configuration and I was not able to debug.
解决了我的问题
通过将其设置为“启动项目” 解决方案资源管理器 -> 右键单击项目->设置为启动项目
或
菜单栏->项目或网站 ->设置为启动项目
My problem was fixed by setting it to "Startup Project"
Solution Explorer -> Right Click on the project -> Set as StartUp Project
or
Menu bar -> PROJECT or WEBSITE -> Set as StartUp Project
只是为了帮助其他遇到这个问题的人,我也遇到了这个问题,我的断点都没有被击中。
原来该项目最初是在 Visual Studio 2015 中创建的。我安装了 2008、2010、2015、2017、2019。我是2017年不小心打开的,然后就出现了这个问题。 2015年重新打开,恢复正常。
Just to help others who come across this question, I too had this issue where none of my breakpoints where being hit.
It turned out that the project was originally created in Visual Studio 2015. I have 2008, 2010, 2015, 2017, 2019 installed. I accidentally opened it in 2017 and then this issue occurred. Opened it back up in 2015 and back to normal.