“尚未为此文档加载任何符号。”但他们有!
您可以注意到
符号已正确加载。
我刚刚使用 AddView
短链接
但是,无论我做什么,我都无法在视图中进行调试。
到目前为止我所做的:
- 关闭并打开解决方案
- 关闭并打开 Visual Studio
- 关闭所有 ASP.NET 开发服务器
- 删除所有符号库
.pdb
- 清理解决方案
- 重新构建解决方案
尚未关闭 Windows 7 x64 :-/
As you can notice
Symbols are been correctly loaded.
I just created a view GetCompanies.cshtml
using the AddView
shortlink
But, no matter what I do, I can't debug in the View.
What I did so far:
- Close and Open Solution
- Close and open Visual Studio
- Shutdown all ASP.NET Development Server's
- Deleted all Symbol Libraries
.pdb
- Clean Solution
- Re-Build Solution
did not (yet) shutdown Windows 7 x64 :-/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
有时,如果您遇到硬停止,Visual Studio 临时缓存将会被破坏。
通过删除这些文件夹来清除缓存:
Sometimes if you have a hard stop, Visual Studio temp cache will be screwed.
Clear the cache by deleting these folders:
我在调试 silverlight 时时常发现相同的行为。我的解决方案是清理浏览器的缓存(在最新的 IE 上,单击滚轮按钮、开发人员工具),因为它有时会缓存二进制文件而不加载新文件。
或许与您的观点相同?
I am finding the same behavior from time to time when debugging silverlight. My solution is to clean the browser's cache (on latest IE click on the wheel button, Developer tools), as it sometimes will cache the binary files and not load the new ones.
Perhaps is could be the same with your views?
尝试上述所有方法已经解决这个问题几个小时了。我最终将目标框架更改为 .NET Framework4.5,一切都开始神奇地工作。
Been messing with this problem for a couple hours trying everything above. I finally changed my Target Framework to .NET Framework4.5 and it all started magically working.
这总是很奇怪。我刚刚遇到了这个问题,并通过完全重建整个解决方案来解决它。
不过,还有另一个奇怪的症状:我使用 NUnit 编写的新单元测试(用 NSubstitute 进行模拟)不会通过,因为 NSubstitute 没有返回我希望它返回的内容。我花了几分钟时间试图弄清楚我在 NSubstitute 编程中是否做错了什么,然后当我尝试将调试器附加到 NUnit GUI 时,我看到了该警告。
就在那时,我决定对解决方案进行全面重建,这对我很有用。
所以我想我们要吸取的教训是“在把头撞到墙上之前,尝试完全重建”。
This is always weird. I just had this problem and solved it with a full rebuild of the entire solution.
There was also another strange symptom, though: a new unit test that I had written using NUnit, mocking with NSubstitute, wouldn't pass because NSubstitute wasn't returning what I wanted it to return. I lost a few minutes trying to figure out if I did something wrong programming NSubstitute, then when I tried to attach the debugger to the NUnit GUI I saw that warning.
That's when I decided to do a full rebuild of the solution, and that worked for me.
So I guess the lesson to be learned is "before smashing your head against the wall, try a full rebuild".
对我来说,我以某种方式将目标构建切换为
Release
而不是Debug
For me, I somehow switched my target build to
Release
instead ofDebug
请记住,视图实际上是在您请求页面时编译的(默认情况下)。
这意味着当您在视图中设置断点时:
尚未编译。
它找到了页面的某些编译版本。 就像最后一个工作版本一样...
所以基本上,当您将鼠标悬停在视图中的断点上时查看它所说的内容并没有什么意义(至少在这个考虑)
如果您尝试调试此页面,那么您遇到了问题。查看调试器向浏览器输出的内容并首先修复该问题。我想我们会惊讶地发现有多少人会对此捂脸。
Remember that views are actually compiled when you request the page (by default).
This means when you set a breakpoint in a view:
compiled yet.
that it found SOME compiled version of the page. Like the LAST working version...
So basically its not meaningful information to look at what it says when you mouseover the breakpoint in a view (at least in this regard)
If you are trying to debug this page, then you have a problem. Look at what the debugger is outputting to your BROWSER instead and fix that first. I think we'll be surprised about how many people are going to facepalm at this.
我在 SL5 项目(VS2012)中遇到了这个问题。为了解决这个问题,我需要在
Web
选项卡下的%MyProjectName%.Web
项目属性中设置启用“Silverlight”选项。I had this problem with SL5 project (VS2012). And to fix this, I was needed to set "Silverlight" option enabled in
%MyProjectName%.Web
project properties, underWeb
tab.就我而言,.PDB 文件是在 VS 2012 中加载的(从中加载符号),因此执行清理和构建重建了 .PDB 文件,一切都再次开始工作。
In my case, the .PDB file was hosed (from which the symbols are loaded) in VS 2012, so performing a Clean and Build reconstructed the .PDB file and everything started workign again.
我试图调试已部署的 WCF Windows 服务(在发布模式下编译)并遇到了完全相同的问题。尝试一下...
工作对我来说(终于)就像一个魅力。
I was attempting to debug a deployed WCF windows services (compiled in Release mode) and had the exact same issue. Give this a shot...
Worked like a charm (finally) for me.
删除bin和obj目录
再次运行解决方案。
注意:除非 cshtml 在运行时加载,否则不会加载符号。页面加载时将命中断点。所以等到控制权转到该页面
delete bin and obj directories
run solution again.
Note: Unless that cshtml loads at runtime the symbols are not loaded. On page load that breakpoint will be hit. So wait till control goes to that page