Visual Studio不允许MVC视图中的断点 [英] Visual Studio does not allow breakpoints in MVC views

查看:607
本文介绍了Visual Studio不允许MVC视图中的断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,Visual Studio不允许我在MVC视图中设置断点。这已经发生在我的几十次,但它不会发生在每一个观点,我不知道为什么。

Sometimes Visual Studio does not allow me to set breakpoints in MVC views. This has happened to me scores of times, but it doesn't happen for every view and I don't know why.

当您点击左侧的栏放置断点时,它会放置一个白色圆圈而不是正常的红色圆圈。当您将鼠标悬停在其上时的消息是断点不会受到打击,源代码与原始版本不同。它继续描述如何允许断点被击中,但这会产生奇怪的结果,我不想要这样。

When you click on the left-hand bar to place a breakpoint, it places a white circle instead of the normal red circle. The message when you hover over it is "The breakpoint will not currently be hit. The source code is different from the original version." It goes on to describe how to allow breakpoints to be hit, but that produces strange results and I don't want that anyways.

如果错误是正确的,那么我想运行原始的源代码。我不知道在VS后台发生了什么事情?我尝试重建和所有这些,但它没有帮助。我在VS 2012中以调试模式运行。

If the error is correct, then I want to run the original source code. I don't know what's going on behind the scenes in VS; I try rebuilding and all that but it doesn't help. I'm running in Debug mode in VS 2012.

推荐答案

这可能是由许多事情引起的,但是几个项目,以检查我最近帮助人们:

This could be caused by many things, but a few items to check which I've helped people with recently:


  • 第一步:DLL旁边必须有一个PDB文件启用调试。 (请参阅:什么是PDB文件?)确保您的PDB在执行目录

  • First step: there must be a PDB file alongside the DLL to enable debugging. (see: What is a PDB file?) Make sure you have the PDB in the executing directory.

清理以从bin文件夹中删除所有旧的DLL。

Clean to remove all the old DLLs from your bin folders.

确保您的应用程序正在运行当前代码的构建(与Visual Studio中相同的版本)。不要以为这只是因为你点击构建或部署。如果没有检测到变化,那么事情往往不会发生。检查程序集的构建时间,或更改某些内容并重新构建以查看文件大小更改。

Ensure that your application is running a build of your current code (the same version you have in Visual Studio). Don't assume that it is just because you clicked 'build' or 'deploy'. If no changes were detected then things often don't happen. Check the build time of the assembly, or change something and rebuild to see the file size change.

如果您正在运行Web相关的内容,请确保浏览器不缓存代码,否则IIS不会持续长时间运行的进程。

If you're running something web-related, make sure a browser isn't caching code, or IIS isn't holding a long running process.

杀死任何运行的Visual Studio开发服务器实例(您可以从任务管理器执行此操作,或者更简单地从系统托盘中执行此操作 - 它们看起来像IE徽标,当你将鼠标悬停在他们上面时,他们会告诉你他们运行哪个端口)。

Kill any running Visual Studio Development Server instances (you can do this from task manager, or more simply from the system tray - they look like an IE logo and when you hover over them they'll tell you which port they run on).

使用 iisreset 从命令提示符。

检查Visual Studio中调试的设置(工具>选项>调试>符号)您要自动加载符号,如果要链接其他程序集,则需要在此处引用其PDB文件。

Check the settings for Debugging in Visual Studio (Tools > Options > Debugging > Symbols) You want to automatically load symbols, and if you're linking other assemblies you need to reference their PDB files here.

这篇关于Visual Studio不允许MVC视图中的断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆