I'd like to execute 'vsjitdebugger.exe' for some process using the code below:
var myapp = Process.Start(@"path\to\myapp.exe");
Process.Start("vsjitdebugger.exe", $"-p {myapp.Id}").WaitForExit();
But failed.
The exit code is '-1' without showing the window.
What do I have to do in order to execute vsjitdebugger.exe?
UPATE #1
I'd like to attach debugger to the specific process only instantly.
That's why I profer code way instead of registry way.
To execute as administrator:
var myapp = Process.Start(@"path\to\myapp.exe");
Process.Start(new ProcessStartInfo()
{
FileName = @"vsjitdebugger.exe",
Arguments = "-p {myapp.Id}",
Verb = "runas"
}).WaitForExit();
Failed as well after UAC screen.