ProcessEntry.GetProcesses() throwing exception

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hello,

I am trying tp enumerate the list of running processs on my PocketPC
phone...
This code was working just fine last night, but now this morning I an
getting an exception when calling ProcessEntry.GetProcesses(). The
text of the exception message is "Unable to create snapshot". I cannot
think of anything that might have change between last night and now to
be causing this other than its a new day full of interesting challenges
:)

Here is the code of interest...

Any help would be greatly apreciated.

Thanks,
Mark


using System;
using System.Collections.Generic;
using System.Text;
using OpenNETCF.ToolHelp;

static void Main(string[] args)
{
ProcessEntry[] processes = ProcessEntry.GetProcesses();
foreach (ProcessEntry p in processes)
{
...
}
 
ok... now it works. I looked at the list of running processes and
there was a process called Software Store that was hung waiting for
input. As soon as I killed that process the call to GetProcesses
worked as expected.

Not sure what is going on under the covers in .NET that my process
trying to simply enumerate a list of processes would be impacted by
another process simply waiting for input, but obviously it was.

Thanks.
 
The hunging process should NOT impact your enumeration. To create a
toolhelp snapshot, system needs at least 1MB of continguous committed
memory space. Probably that Software Store acquires too much memory?
 
Back
Top