visual-studio 如何在不停止进程的情况下停止调试(或分离进程)?

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

How to stop debugging (or detach process) without stopping the process?

visual-studiovisual-studio-2008debugging

提问by Valentein

I often use VS 2008 to debug a .NET C# component of an application. Sometimes, I want to quit debugging and continue running the application. Stop Debugging kills the process I was debugging.

我经常使用 VS 2008 来调试应用程序的 .NET C# 组件。有时,我想退出调试并继续运行应用程序。停止调试会终止我正在调试的进程。

How can I achieve my aim?

我怎样才能实现我的目标?

This is not a web app, it's a local process that runs managed and unmanaged code.

这不是 Web 应用程序,而是运行托管和非托管代码的本地进程。

I found the "Detach All"option in the Debug menu, however it is disabled (grayed out).

我在调试菜单中找到了“全部分离”选项,但是它被禁用(变灰)

采纳答案by Harsh Verma

You cannot detach a debugger from a process if you are debugging in mixed mode.

如果您在混合模式下调试,则不能从进程中分离调试器。

Make sure you are debugging either in managed or native mode while attaching to the process: either make sure "Enable native code debugging" or "Native Code" is unchecked in your project options, or start the program without debugging, choose "Attach to Process", and select only Managed or only Native.

确保在附加到进程时以托管模式或本机模式进行调试:确保在项目选项中取消选中“启用本机代码调试”或“本机代码”,或者在不调试的情况下启动程序,选择“附加到进程” ",然后选择仅托管或仅本机。

回答by sbi

Open the Processes window (Debug->Windows->Processes), right-click the process, select "Detach Process".

打开进程窗口(Debug->Windows->Processes),右键单击进程,选择“分离进程”。

回答by Svisstack

Debug -> Detach All

调试 -> 全部分离

Works great on my VS2008 and VS2010.

在我的 VS2008 和 VS2010 上运行良好。