I’m trying to get the list of running processes / sessions on my computer with Win7 using the following code, which is found in internet. However it doesn’t work? I have not got any compile errors.
namespace CurrentProcessesLister
{
class Program
{
static void Main(string[] args)
{
Process[] runningProcesses = Process.GetProcesses();
var currentSessionID = Process.GetCurrentProcess().SessionId;
Process[] sameAsthisSession = (from c in runningProcesses where c.SessionId == currentSessionID select c).ToArray();
foreach (var p in sameAsthisSession)
{
Trace.WriteLine(p.ProcessName);
}
}
}
}
Then replace
with
But if you then still don’t see anything, it’s time to start using the debugger.