vb.net 当前不会命中断点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17195006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 13:58:24  来源:igfitidea点击:

The breakpoint will not currently be hit

vb.netvisual-studio-2010breakpoints

提问by Jimmy D

"The breakpoint will not currently be hit. No symbols have been loaded for this document."

“当前不会命中断点。没有为此文档加载符号。”

This is Visual Studio 2010 trying to debug a VB/ASP.Net web "site," NOT a web "application." I say that because most of the "fixes" I find on the internet involve changing project settings that don't exist for a web site project.

这是 Visual Studio 2010 试图调试 VB/ASP.Net 网站“站点”,而不是网络“应用程序”。我这么说是因为我在 Internet 上找到的大多数“修复”都涉及更改网站项目不存在的项目设置。

If I look in the modules windows when the debugger is running I'm not even sure what module I should be concerned with. If it helps I'm just trying to put a breakpoint on a button on an aspx page.

如果我在调试器运行时查看模块窗口,我什至不确定我应该关注哪个模块。如果它有帮助,我只是想在 aspx 页面上的按钮上放置一个断点。

EDIT: It seems that I can hit breakpoints on all pages except for pages that use a different masterpage.For example, I have a masterpage at the root of the site that several pages use. Any of these pages work fine when I set breakpoints. But then I have folders off of the root with other pages in those folders. Some of these nested folders have their own masterpage. None of the pages that use a nested masterpage will hit breakpoints. So what does that mean?

编辑:除了使用不同母版页的页面外,我似乎可以在所有页面上都打断点。例如,我在多个页面使用的站点根目录下有一个母版页。当我设置断点时,这些页面中的任何一个都可以正常工作。但是后来我在这些文件夹中将文件夹与其他页面分开。其中一些嵌套文件夹有自己的母版页。使用嵌套母版页的页面都不会命中断点。那是什么意思呢?

EDIT 2: There is no "fix" for this problem because Microsoft has acknowledged that it's a bug.There are many work arounds that work for some people but not others, and I did figure out what my own problem was so I'm going to answe my own question.

编辑 2:这个问题没有“修复”,因为微软已经承认这是一个错误。有很多变通办法适用于某些人但不适用于其他人,我确实弄清楚了我自己的问题是什么,所以我要回答我自己的问题。

回答by Jimmy D

I have learned that there is no "fix" for this problem because Microsoft has acknowledged that it's a bug. People post hacky work arounds and say "Here's how to fix it" but their "fix" only works for THEM.

我了解到这个问题没有“修复”,因为微软已经承认这是一个错误。人们发布hacky work arounds并说“这是修复它的方法”,但他们的“修复”仅适用于他们。

What I realized is that my breakpoints DO get hit, the breakpoint symbol just won't turn into a solid red dot until I actually navigate to the page where the breakpoint is while debugging!

我意识到我的断点确实被击中了,断点符号不会变成实心红点,直到我在调试时真正导航到断点所在的页面!

So for example if I set a breakpoint while NOT debugging the symbol has the warning mark and says this breakpoint won't be hit. I suspect a lot of people stop right here (like I did) and try to fix the problem. Even if you launch the site in debug mode, the symbol still shows the warning. BUT as soon as you navigate to the page in the browser the symbol turns solid and the breakpoint hits. So maybe there are no debug symbols for that specific page until you navigate to it and it gets compiled? But why does that only happen with SOME pages? THAT is the bug. And I read a MS article where it was acknowledged. So good luck to everyone struggling with this annoyance.

因此,例如,如果我在不调试时设置断点,则符号具有警告标记并表示不会命中该断点。我怀疑很多人就在这里停下来(就像我一样)并尝试解决问题。即使您在调试模式下启动站点,该符号仍会显示警告。但是,一旦您导航到浏览器中的页面,符号就会变成实心并且断点命中。因此,在您导航到该特定页面并对其进行编译之前,可能没有该特定页面的调试符号?但为什么这只会发生在某些页面上?那就是错误。我读了一篇 MS 文章,在那里得到了承认。祝所有在这种烦恼中挣扎的人好运。

回答by Niranga

Try changing Active Solution Configuration to "Debug" and Solution Platform from to "Any CPU"

尝试将活动解决方案配置更改为“调试”,将解决方案平台从“任何 CPU”更改为

回答by Jay

Try putting the breakpoint right at the very top of your code. Does it work there?

尝试将断点放在代码的最顶部。它在那里工作吗?