Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop the Visual Studio debugger starting my process in a job object?

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.

like image 808
1800 INFORMATION Avatar asked Sep 18 '08 03:09

1800 INFORMATION


People also ask

How do I stop auto debugging in Visual Studio?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.

How do I stop a process in Visual Studio?

If you're debugging, try hitting SHIFT-F5.

How do I stop a program debugging?

Click the Stop button on the toolbar of the Debug tool window. Alternatively, press Ctrl+F2 and select the process to terminate (if there are two or more of them).

How do I stop debugging in VS code?

VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program. Tip: The Run action is always available, but not all debugger extensions support 'Run'.


1 Answers

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.

like image 178
Tom Minka Avatar answered Sep 17 '22 11:09

Tom Minka