.net Visual Studio 2010 调试未启动,F5 或单击“播放”不起作用,不执行任何操作。等待 2-3 分钟即可解决问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6103250/
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-03 15:35:57  来源:igfitidea点击:

Visual Studio 2010 debug not starting, F5 or click on "Play" not working, not doing anything. Waiting 2-3 minutes solves the issue

.netvisual-studio-2010debuggingc#-4.0

提问by Diego

I have a relatively simple C# (Framework 4) console application. When I click the "Play" icon or hit F5(i.e. start the program in debug mode), the icon becomes gray for a second, then goes back to green, but nothing happens. If I wait 2 or 3 minutes and try again, the debug session starts up normally, breakpoints are hit and everything.

我有一个相对简单的 C#(框架 4)控制台应用程序。当我单击“播放”图标或点击F5(即在调试模式下启动程序)时,图标会变成灰色一秒钟,然后变回绿色,但没有任何反应。如果我等待 2 或 3 分钟再试一次,调试会话会正常启动,断点被击中等等。

Things I have tried without success:

我尝试过但没有成功的事情:

  • Cleaning the solution, then rebuilding.
  • Renaming the output assembly.
  • Restarting Visual Studio.
  • 清洁溶液,然后重建。
  • 重命名输出程序集。
  • 重新启动 Visual Studio。

The only thing that works is just waiting. I don't see any related processes still running during these 2-3mins (svchost, conhost, *.vshost or cmd).

唯一有效的就是等待。在这 2-3 分钟(svchost、conhost、*.vshost 或 cmd)期间,我没有看到任何相关进程仍在运行。

采纳答案by Adrian McCarthy

I've seen this problem when my network connection is flakey and I've set the debugger to automatically download symbols from Microsoft's symbol server. It tries for a long time, then times out, then life proceeds. There should be clues in the Output window (where it normally lists all the modules being loaded and whether it got symbols for them).

当我的网络连接不稳定并且我已将调试器设置为自动从 Microsoft 的符号服务器下载符号时,我已经看到了这个问题。它尝试了很长时间,然后超时,然后生活继续。在输出窗口中应该有线索(它通常会列出所有正在加载的模块以及是否为它们提供了符号)。

回答by Loki

try this: open Task Manager, go to processes tab and look for process named after your app. if its there just kill the bastard and try to debug again. for me it worked like miracle

试试这个:打开任务管理器,转到进程选项卡并查找以您的应用程序命名的进程。如果它在那里只是杀死混蛋并尝试再次调试。对我来说它就像奇迹一样

回答by L.A

Its happened for me.The cause was because i had my project open in 2 times in 2 differents visual studio and one was waiting for me to answers a question in a message box. The message was about files file was modified outside source editor and was asking me if I wanted to load change. Hope it will help some people and sorry for my english.

它发生在我身上。原因是因为我在 2 个不同的视觉工作室中打开了我的项目 2 次,其中一个在等待我在消息框中回答问题。该消息是关于文件文件在源代码编辑器之外被修改,并询问我是否要加载更改。希望它会帮助一些人,并为我的英语感到抱歉。

回答by Valery Letroye

I my case, it's due to the use of a vshost. I don't clearly understand yet why. It's possibly due to the running platform (a Win7 x64 where I am not - and may not be - administrator) combined with other factors

我的情况,这是由于使用了vshost。我还不清楚为什么。这可能是由于运行平台(Win7 x64,我不是 - 也可能不是 - 管理员)以及其他因素

But I can debug (using F5) if I disable the use of vshost via the "Project Properties > Debug tab > "Enable the Visual Studio hosting process".

但是,如果我通过“项目属性 > 调试选项卡 >”启用 Visual Studio 托管进程禁用 vshost 的使用,我可以调试(使用 F5)。

回答by SharpAffair

This issue can also occur if you disable "Application Experience" service in Windows, as many system optimization sites suggest.

如果您禁用Windows 中的“应用程序体验”服务,也会出现此问题,正如许多系统优化站点所建议的那样。

The service can be re-enabled using msconfig or services.msc, this completely solved the issue for me.

可以使用 msconfig 或 services.msc 重新启用该服务,这完全解决了我的问题。

回答by bobr

I had a problem like this. I was having problems using "run" when the network was involved.

我有这样的问题。当涉及网络时,我在使用“运行”时遇到问题。

I moved all of the files related to the program/solution to my local hard-drive (C:); they were on a network drive. Be sure to check the "References" (Look under the "Project" pull-down for the properties; then look for "References").

我将所有与程序/解决方案相关的文件移动到我的本地硬盘驱动器 (C:);他们在网络驱动器上。请务必检查“参考”(在“项目”下拉列表下查找属性;然后查找“参考”)。

I would make sure all references are on you local hard-drive and set the "Path" correctly (to the reference on you local hard-drive) in the References tab. This seemed to fix the issue.

我会确保所有引用都在您的本地硬盘驱动器上,并在“引用”选项卡中正确设置“路径”(到您本地硬盘驱动器上的引用)。这似乎解决了这个问题。

回答by C00lGuy

See what happens if you try "Release" instead of "Debug". If release works, then its because of a process (that you can find in Task Manager) which name is {Name of your Project}.vshost.exe
It's description is "vshost32" so you can sort by description alphabetically to find it easies.

看看如果您尝试“发布”而不是“调试”会发生什么。如果发布有效,那么它是因为一个进程(您可以在任务管理器中找到),其名称为{您的项目名称}.vshost.exe
它的描述是“vshost32”,因此您可以按字母顺序对描述进行排序以轻松找到它。

回答by josepainumkal

It can also happen if an another application is attached to the debug process. Once, I attached ants memory profiler to the visual studio(VS2012) debug process. Later, I stopped the debugging and try to run it again, but VS2012 didn't allow me to debug. Only after stopping the ants profiler session, I was able to debug again.

如果另一个应用程序附加到调试过程,也可能发生这种情况。有一次,我将 ants 内存分析器附加到 Visual Studio(VS2012) 调试过程。后来,我停止调试并尝试再次运行它,但是VS2012不允许我调试。只有在停止 ants profiler 会话后,我才能再次调试。

回答by Mav

Check the Project Properties in the Compile tab, select the Advanced Compile Options.

检查编译选项卡中的项目属性,选择高级编译选项。

If you are targeting the .NET Framework 4 Client Profile, you cannot reference an assembly that is not in the .NET Framework 4 Client Profile.

如果您的目标是 .NET Framework 4 Client Profile,则不能引用不在 .NET Framework 4 Client Profile 中的程序集。

More information about the .Net Framework 4 Client Profilehere

有关此处的更多信息.Net Framework 4 Client Profile

回答by sfuqua

Apparently there are many root causes for this. In my case - opened an old application for the first time in VS2010. The solution was upgraded. Everything compiles without error - but app won't start. There are half a dozen class libraries linked to the application. Turns out one of them was still compiling to .Net Framework 3.5, whereas all the others had automatically upgraded to .Net Framework 4. Likely there was an error message in the conversion log, whose import I didn't heed at the time. Once I changed that last library to use 4 instead of 3.5, everything ran smoothly.

显然,这有很多根本原因。就我而言 - 在 VS2010 中第一次打开旧应用程序。解决方案已升级。一切都编译没有错误 - 但应用程序不会启动。有六个类库链接到该应用程序。结果发现其中一个仍在编译到 .Net Framework 3.5,而所有其他人都已自动升级到 .Net Framework 4。可能在转换日志中有一条错误消息,当时我没有注意到它的导入。一旦我将最后一个库更改为使用 4 而不是 3.5,一切运行顺利。