简体   繁体   English

Visual Studio 2010/2012:在断点处停止调试时,调试过程挂起并且不可用

[英]Visual Studio 2010/2012: when Stop Debugging on breakpoint hit debugged process hangs and is unkillable

Happens with some occasion. 发生在一些场合。 Running Windows 8 x64, with Visual Studio 2012 Professional (also happened before in VS 2010). 使用Visual Studio 2012 Professional运行Windows 8 x64(在VS 2010中也曾发生过)。 C# console project being debugged with "Enable native code debugging". 正在使用“启用本机代码调试”调试C#控制台项目。

Pressing F5, debugging some code, reaching breakpoints, etc. then pressing Shift+F5 (Stop Debugging) and the Visual Studio does not return to editing mode as normally, it just hangs for a while and then gives an option to terminate the hanging operation (dialog window "A remote operation is taking longer than expected" with progress bar and Terminate button). 按F5,调试一些代码,到达断点等,然后按Shift + F5(停止调试),Visual Studio不会像往常一样返回编辑模式,只是挂起一段时间,然后提供终止挂起操作的选项(对话框窗口“远程操作花费的时间比预期的要长”,带有进度条和终止按钮)。 If I don't click to terminate, it stays there just updating the progress bar. 如果我没有点击终止,它只会更新进度条。 If I click to terminate the operation, VS returns back to editable mode but the debugged process is still visible in Task Manager and its not killable. 如果我单击以终止操作,VS将返回可编辑模式,但调试过程仍在任务管理器中可见,并且不可用。 This pending debug process locks certain files it uses (eg DLLs) so further rebuild is not possible. 这个挂起的调试过程会锁定它使用的某些文件(例如DLL),因此无法进一步重建。 The only way to kill this process is to restart the machine. 杀死此过程的唯一方法是重新启动计算机。

Interestingly it happens when the breakpoints are reached in debugged code and debugging is performed step by step. 有趣的是,在调试代码中达到断点并逐步执行调试时会发生这种情况。 If I just run the debugging process without breakpoints then the hang does not occur. 如果我只运行没有断点的调试过程,则不会发生挂起。

Solutions in the following thread didn't help: https://connect.microsoft.com/VisualStudio/feedback/details/504538/ 以下主题中的解决方案没有帮助: https//connect.microsoft.com/VisualStudio/feedback/details/504538/

We have faced similar issues before using 2010, but couldn't figure out the root cause yet. 我们在使用2010之前遇到过类似的问题,但还未找出根本原因。

The workaround was to run the process separately (console, double click the .exe) and do Debug->Attach To Process . 解决方法是单独运行该进程(控制台,双击.exe)并执行Debug-> Attach To Process Note: If you wanna debug start up code then this might not be a good idea. 注意:如果你想调试启动代码,那么这可能不是一个好主意。

I was experiencing some serious unaccountable issues regarding file locks and weird behaviour of the debugger a while ago. 我刚刚遇到一些关于文件锁和调试器奇怪行为的严重不负责任的问题。 I solved them by activating application experience service. 我通过激活应用程序体验服务解决了它们 I don't know why but after activating it all my problems regarding debugging silently vanished... 我不知道为什么但是在激活之后我所有关于调试的问题都默默地消失了......

I came across a similar hanging problem and solved it. 我遇到了类似的悬挂问题并解决了它。 Trying it may heal your wound (it is for windows forms, but since you're on console, it is worth giving a try): 尝试它可以治愈你的伤口(它适用于Windows窗体,但是因为你在控制台上,所以值得一试):

Windows Form Won't Display in Debug Mode Windows窗体不会在调试模式下显示

Please let me know if it works or not. 如果有效,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM