FAiled to attach Visual Studio 2008 to an application with IronPython on Vista
-
10-07-2019 - |
Question
I'd like to create new command line to attach Visual Studio to an application with IronPython:
My Script:
import clr
import System
from System.Runtime.InteropServices import Marshal
DTE = Marshal.GetActiveObject('VisualStudio.DTE')
curLocalProcess = DTE.Debugger.LocalProcesses
print curLocalProcess.Count
currentProc = curLocalProcess.Item(1)
currentProc.Attach()
While, I encounter a problem on Vista:
EnvironmentError: Visual Studio has insufficient privileges to debug this process.
To debug this process, Visual Studio must be run as an administrator.
I suppose it's not a issue of IronPython but about Vista Security. However, I cannot figure out a solution for this even after I run Visual Studio 2008 SP1 and IronPython as Administrator. Except that, I also turned off UAC.
I also notice that "Run this program as an administrator" in Properties - Compatibility tab for Visual Studio is grayed.
Do you have any comments or suggestions?
Solution
You need to invoke an elevated VSStudio IDE via script. Or else run the app & script in Built in Administrator account or in a normal admin account with UAC off.
using System.Diagnostics;
Process p = new Process();
ProcessStartInfo pp = new ProcessStartInfo();
pp.Verb = "runas";//Invoke as Admin
//Do other initialzation.
p.StartInfo = pp;
p.Start();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow