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

InvalidOperationException - which counters need to be enabled on our XPe image?

58 views
Skip to first unread message

Burkhard

unread,
Jan 19, 2005, 4:46:27 PM1/19/05
to
We are receiving the following error on XP Embedded only
when calling the C#
System.Diagnostics.Process.GetProcessesByName method:

D:\_WTA>calc_test_process.exe
System.InvalidOperationException: Process performance
counter is disabled, so the requested operation cannot be
performed.
at System.Diagnostics.NtProcessManager.GetProcessInfos
(PerformanceCounterLib library)
at System.Diagnostics.NtProcessManager.GetProcessInfos
(String machineName, Bo olean isRemoteMachine)
at System.Diagnostics.ProcessManager.GetProcessInfos
(String machineName)
at System.Diagnostics.Process.GetProcessesByName(String
processName, String machineName)
at System.Diagnostics.Process.GetProcessesByName(String
processName)
at Calc_Test_Process.Class1.Main(String[] args)


This is using a small test program recommended by a
previous post:

try
{
Process [] localByName =
Process.GetProcessesByName("calc");
Console.WriteLine (localByName.Length);
}
catch(Exception ex)
{
Console.WriteLine (ex.ToString());
}

The code works fine on Windows 2000 / NT Manager
Workstation. Running Performance Monitor shows the
counters ok, and searching the registry for: "Disable
Performance Counters" set to 1 yields no results.

Which counters need to be enabled on our XPe image to have
the method succeed?

Thanks,
Burkhard
SQA Tester

KM

unread,
Jan 19, 2005, 5:18:47 PM1/19/05
to
Burkhard,

Do you have Pagefile support enabled on your image?

--
Regards,
KM, BSquare Corp.

Burkhard

unread,
Jan 19, 2005, 5:33:14 PM1/19/05
to
Hi KM,

Yes, the Pagefile support is enabled (set to: 192-512 MB).
Are we missing a component or registry entry we are not
aware of?


Thanks,
Burkhard

>.
>

KM

unread,
Jan 19, 2005, 5:56:05 PM1/19/05
to
Burkhard,

It is SP1 or SP2 image?

Open the registry section of the "Performance Counter Configuration" component and disable the following registry key:
[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009].
Some more info here: http://support.microsoft.com/?id=300956

Let us know if this fixes the problem.

KM

unread,
Jan 19, 2005, 6:08:18 PM1/19/05
to
And I hope you are trying the code from an account that has Admin privileges.

Burkhard

unread,
Jan 19, 2005, 7:15:53 PM1/19/05
to
It's SP1 - yes, we are running as a user who is a Computer
Administraor on XPe. The only registry key under:
HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Perflib\009
is a Binary key called (Default) with a zero-length binary
value. On my working Windows 2000 this key is a String;
not sure if this makes a difference. I'll try the
suggestion from the article next.

Thanks,
Burkhard

>.
>

KM

unread,
Jan 19, 2005, 7:30:13 PM1/19/05
to
Burkhard,

You have to delete the Perflib\009 key.
You can do that in TD in the "Performance Counter Configuration" component's registry section.
Or in the pre-FBA system hive offline.

Burkhard

unread,
Jan 19, 2005, 7:41:09 PM1/19/05
to
What's TD or pre-FBA?
I pressed delete from regedit; that got rid of the \009
key.
After a re-boot, now the code WORKS!!

THANKS A LOT,
Burkhard

>.
>

KM

unread,
Jan 19, 2005, 7:53:24 PM1/19/05
to
Burkhard,

Well.. I was under impression you were building the image yourself :-)

TD = Target Designer, FBA = Fisrt Boot Agent.
These XPe dev tools do not make sense to you if you are just "fixing" the XPe image that has already been built and deployed for you
by someone else.

Anyway, I am glad that was the fix for you.

Btw, this issue has been fixed in XPe SP2.

Burkhard

unread,
Jan 19, 2005, 7:59:36 PM1/19/05
to
KM,

We are working with POS systems, and are about to "try-
out" the soon to come new "WePOS" OS from MS (in an
attempt not to having to test SP2...). I'll let my
Integration Dept know.

Thanks again,
Burkhard

>.
>

0 new messages