本文介绍了如何停止在工作对象中启动我的进程的Visual Studio调试器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从Visual Studio开始我的进程时,它始终在作业对象内创建。我想知道如何解决这个问题。任何想法?



我希望在被调试的作业对象中创建它。我想将我的程序放在不同的工作对象中。



这不是托管过程。我在谈论一个。这是一个非托管的C ++应用程序。

解决方案

devenv.exe VSLauncher.exe 以兼容模式运行。 (PCA)将作业对象附加到Visual Studio进程,并且每个子进程继承它。检查作业名称(由Process Explorer报告)以 PCA 开头。如果是这样,可以如链接中所述禁用PCA。



您可以使用运行 - > gpedit.msc - > 管理模板\ Windows组件\\应用程序兼容性 - > 关闭程序兼容性助手 - > 启用



您可以通过添加注册表项来禁用特定可执行文件的PCA。对于Windows 7,相应的注册表项为 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant 。在regedit中,右键单击该键,选择新建 - > 多字符串值,将其命名为$ code> ExecutablesToExclude 。将值设置为单独的行和不带引号的 denenv.exe VSLauncher.exe 的完整路径。对于我来说,这些是:

  C:\程序文件(x86)\Microsoft Visual Studio 10.0 \Common7\ IDE\devenv.exe 
C:\程序文件(x86)\Common Files\microsoft shared\MSEnv\VSLauncher.exe

When I start my process from Visual Studio, it is always created inside a job object. I would like to know how to turn this behaviour off. Any ideas?

I expect that it is created in a job object to be debugged. I want to place my program in a different job object.

It's not the hosting process. I'm talking about a Job Object. This is an unmanaged C++ application.

解决方案

This happens when devenv.exe or VSLauncher.exe run in compatibility mode. The Program Compatibility Assistant (PCA) attaches a job object to the Visual Studio process, and every child process inherits it. Check if the job name (as reported by Process Explorer) starts with PCA. If so, PCA can be disabled as described in the link.

You can globally disable PCA using Run -> gpedit.msc -> Administrative Templates\Windows Components\Application Compatibility -> Turn off Program Compatibility Assistant -> Enable.

You can disable PCA for specific executables by adding a registry entry. For Windows 7, the appropriate registry key is HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant. In regedit, right-click that key, select New -> Multi-String Value, name it ExecutablesToExclude. Set the value to the full path of denenv.exe and VSLauncher.exe, on separate lines and without quotes. For me, these were:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VSLauncher.exe

A related issue, on Windows 7, is that executables you build in Visual Studio and run from Explorer (not Visual Studio or the command line) may run in compatibility mode, and again get job objects wrapped around them. To prevent this, your executable needs a manifest that declares compatibility with Windows 7, using the new Application Manifest Compability section. The link gives an example of a Windows 7 compatible manifest. The default manifest provided by Visual Studio 2010 does not include this Compatibility section.

这篇关于如何停止在工作对象中启动我的进程的Visual Studio调试器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 12:53