.net Visual Studio 2015 项目不再在调试模式下运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31992705/
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
Visual Studio 2015 project no longer runs in debug mode
提问by Sen
This is what I get even when I run in the Debug configuration:
这就是我在调试配置中运行时得到的结果:
The way I got this to show was by enabling "Just My Code"and warn if there isn't any user code on launch. This is something that recently happened to our project, and I'm not sure what we did to cause this. But I've been unable to fix it. Breakpoints won't fire and quick watch gives weird results.
我让这个显示的方式是启用“仅我的代码”并警告启动时是否没有任何用户代码。这是我们项目最近发生的事情,我不确定我们做了什么导致这种情况。但我一直无法修复它。断点不会触发,快速观察会给出奇怪的结果。
I've tried googling the issue, but none of the standard "break points won't fire" solutions have worked. I'm all out of ideas.
我试过在谷歌上搜索这个问题,但没有一个标准的“断点不会触发”解决方案奏效。我都没有想法了。
I've checked the configuration manager and every project is also set to Debug there as well.
我检查了配置管理器,每个项目也都设置为调试。
I turned off "Enable Optimaizations", and I no longer get the "you are debugging a Release build" dialog. It runs and stops on breakpoints again! However the output window displays this at start up:
我关闭了“启用优化”,并且不再出现“您正在调试发布版本”对话框。它再次运行并在断点处停止!然而,输出窗口在启动时显示:
Symbols for the module 'Navigo.exe' were not loaded.
- Use a debug build configuration or disable the debug option 'Enable Just My Code'.
- Check the 'Symbols' settings under debugging options.
未加载模块“Navigo.exe”的符号。
- 使用调试构建配置或禁用调试选项“启用我的代码”。
- 检查调试选项下的“符号”设置。
So this solves my primaryproblem of no longer being able to use breakpoints and the popup. Which is odd since I thought you needed symbols to be loaded for breakpoints to work. So how can the breakpoints work if the symbols aren't loaded? Maybe it's just a bad message?
所以这解决了我不再能够使用断点和弹出窗口的主要问题。这很奇怪,因为我认为您需要加载符号才能使断点工作。那么如果没有加载符号,断点如何工作?也许这只是一个坏消息?
采纳答案by stuartd
Use the Configuration Manager to check what the actual settings are for the Debug configuration - it's at menu Build→ Configuration Manager...- in case they are set to use Release:
使用配置管理器检查调试配置的实际设置 - 它位于菜单Build→ Configuration Manager...- 如果它们被设置为使用Release:
Also, make sure the project is defining DEBUGcorrectly, and that "Optimize Code" is not checked:
另外,请确保项目正确定义了DEBUG,并且未选中“优化代码”:
回答by Adam J.
This has happened to me on a couple of projects too. I reviewed my build settings, as suggested by stuartd. However, 'Optimize code' was notenabled in my build settings. So I enabled it and saved the project. Then I unchecked it and saved again. Problem solved.
这也发生在我身上的几个项目中。我按照 stuartd 的建议查看了我的构建设置。但是,我的构建设置中未启用“优化代码” 。所以我启用了它并保存了项目。然后我取消选中它并再次保存。问题解决了。
There's some kind of bug that causes the --optimize+flag to be passed to the debugger. Enabling it and then disabling it is an easy workaround until the bug is fixed.
有某种错误导致--optimize+标志被传递给调试器。启用它然后禁用它是一个简单的解决方法,直到错误得到修复。
回答by John T
This started happening to me after applying Update 1. Existing projects started showing this, and I can replicate it with a brand new project. All configuration is set to DEBUG, and Optimizeis notchecked.
在应用更新 1 后,这开始发生在我身上。现有项目开始显示这一点,我可以用一个全新的项目复制它。所有的配置设置为DEBUG,并优化是不检查。
The kicker is, running the project the first time (or after a Clean) runs just fine, without any message. Stopping, then re-running the project (note - the project is not rebuiblt) will display the dialog.
关键是,第一次(或在 Clean 之后)运行项目运行得很好,没有任何消息。停止,然后重新运行项目(注意 - 该项目不是 rebuiblt)将显示该对话框。
The only solution is to turn off the Just My Codeoption - which seems a hack, as it was on previous to Update 1 without any problems.
唯一的解决方案是关闭“仅我的代码”选项 - 这似乎是一个黑客,因为它在更新 1 之前没有任何问题。
回答by Dmitry Rotay
If none of mentioned solutions has helped, check your project's AssemblyInfo.cs for explicit DebuggableAttribute application. It seems like it overrides compiler's debug/release options.
如果上述解决方案都没有帮助,请检查项目的 AssemblyInfo.cs 以获取显式 DebuggableAttribute 应用程序。它似乎覆盖了编译器的调试/发布选项。
I had this line in the file in my case (legacy project, no idea how it got there). Deleting it solved the problem:
在我的案例中,我的文件中有这一行(遗留项目,不知道它是如何到达那里的)。删除它解决了问题:
[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
回答by romanoza
Select menu Debug→ Optionsand unselect the Suppress JIT optimizationoption. It works for me.
选择菜单Debug→ Options并取消选择Suppress JIT optimization选项。这个对我有用。
来源:https: //connect.microsoft.com/VisualStudio/feedback/details/2116788/flag-optimize-is-passed-to-the-debugger-even-while-the-build-settings-optimize-code-is- not-enabled-on-mvc-c-web-projects-when-using-just-my-code
回答by Thijs
I encountered this issue as well. The fix that worked for was to simply clean (Build > Clean Solution) and rebuild (Build > Rebuild Solution) my projects.
我也遇到了这个问题。有效的修复方法是简单地清理 ( Build > Clean Solution) 并重建 ( Build > Rebuild Solution) 我的项目。
回答by wezten
回答by akiller
In my case the problem was that the IIS Project URLin my ASP.NET project properties web tab was set to the wrong URL.
就我而言,问题是我的 ASP.NET 项目属性 Web 选项卡中的 IIS项目 URL设置为错误的 URL。
It was pointing to http://localhostwhich I was using with a different copy of the project. The address for the solution I had open was actually configured on my local IIS as http://localhost:90.
它指向http://localhost,我正在使用该项目的不同副本。我打开的解决方案的地址实际上在我的本地 IIS 上配置为http://localhost:90。
Changing to the correct address fixed the problem.
更改为正确的地址解决了问题。
回答by dispake
Just adding a side note to stuartd's answer:
只需在stuartd 的回答中添加一个旁注:
Be sure you check any dependent projects for the same build settings. You will get the same message prompt if your main project has the proper settings, but your dependent projects do not. It makes obvious sense in hindsight, but it wasn't the first thing to come to mind.
确保检查任何依赖项目的相同构建设置。如果您的主项目具有正确的设置,但您的从属项目没有,您将收到相同的消息提示。事后看来,这显然是有道理的,但这并不是第一个想到的事情。
回答by Kim Rasmussen
I had the same issue... No matter what I did - nothing worked.
我有同样的问题......无论我做什么 - 都没有效果。
It was an new empty project that was the problem. I ended up removing the project and adding a new project- the new project had to have another name; if I used the same name the error just reappeared - even after a reboot, clean and rebuild... It must be a bug in Visual Studio 2015.
这是一个新的空项目,这是问题所在。我最终删除了该项目并添加了一个新项目- 新项目必须有另一个名称;如果我使用相同的名称,错误就会再次出现 - 即使在重新启动、清理和重建之后......它一定是 Visual Studio 2015 中的错误。


