Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Process.GetProcessesByName returning an error..

343 views
Skip to first unread message

Doug

unread,
Jun 13, 2002, 5:19:10 PM6/13/02
to
The error I'm getting is Process performance counter is disabled, so
the requested operation cannot be performed.

Is there something I can do to enable this performance counter? How
common will it be that the process performance counter will be
disabled?

Thanks in advance
Doug

Anna Neiderud

unread,
Jun 27, 2002, 5:17:39 AM6/27/02
to
Sorry, I don't have a solution, but the same problem. I have code that
works on most machines, but a few will give the error you describe.
Removing the following two lines of code from my application will make
it work on all machines:

string pname = Process.GetCurrentProcess().ProcessName;
Process[] parr = Process.GetProcessesByName(pname);

Is this a .Net bug? Is there some setting in Windows 2000 that can
make it work? The machine that I currently know where it doesn't work
is a Windows 2000 SP2, but it works fine on others with the same
configuration.

/Anna Neiderud

Willy Denoyette [MVP]

unread,
Jun 27, 2002, 4:36:46 PM6/27/02
to
For which which process?
From which user context are you calling this?

Willy.

"Doug" <dto...@yahoo.com> wrote in message news:3d090aa1....@news.easynews.com...

Anna Neiderud

unread,
Jun 28, 2002, 3:20:52 AM6/28/02
to
> For which which process?
> From which user context are you calling this?

I was calling it from a very basic windows form application with
everything but a window and those lines stripped away.

The application was compiled with Visual Studio and then moved to a
machine with only the redistributable .Net installed. A regular user
executed the application and gets the error 100% reproducible.

/Anna

Willy Denoyette [MVP]

unread,
Jun 28, 2002, 11:24:09 AM6/28/02
to
Sorry but a was replying to Doug,
What exception is getting thrown, when you call GetProcessesByName?

Willy.

"Anna Neiderud" <anna.n...@jaczone.com> wrote in message news:5e14eba7.02062...@posting.google.com...

Anna Neiderud

unread,
Jul 1, 2002, 4:20:42 AM7/1/02
to
> What exception is getting thrown, when you call GetProcessesByName?

InvalidOperationException

Anna Neiderud

unread,
Jul 1, 2002, 9:02:48 AM7/1/02
to
> Is there something I can do to enable this performance counter? How
> common will it be that the process performance counter will be
> disabled?

I succeeded to reenable the appropriate performance counter by opening
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance
in
the registry and removing an entry named "Disable Performance
Counters".

More information can be found at:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q249138
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q248993

/Anna

0 new messages