Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2005

Tip: Looking for answers? Try searching our database.

XPe - Process.GetProcessesByName - InvalidOperationException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
- 19 Jan 2005 16:33 GMT
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 th
e 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 m
achineName)
  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.

Any idea?

Thanks,
Burkhard
SQA Tester
Phil Wilson - 19 Jan 2005 21:24 GMT
Not sure if this helps, but the explanation is that this Process class
method uses the performance counters to get the process list, and on that
XPe system the counters are disabled. XPe systems are typically built by
picking components to include in the OS. XPe doesn't necessarily have the
same features as XP. If this is your XPe, you might be able to create the
image to include the performance counters (ask in the XP embedded group).
Otherwise the only thing I can think of is use the Win32 APIs.
Signature

Phil Wilson [MVP Windows Installer]

> We are receiving the following error on XP Embedded only
> when calling the C#
[quoted text clipped - 45 lines]
> Burkhard
> SQA Tester
Burkhard - 19 Jan 2005 21:38 GMT
Thanks for the reply, Phil.

Which Win32 API call would you use?

Thanks,
Burkhard

>-----Original Message-----
>Not sure if this helps, but the explanation is that this Process class
[quoted text clipped - 55 lines]
>
>.
anonymous@discussions.microsoft.com - 20 Jan 2005 16:41 GMT
WORKAROUND: DELETE the "\009" registry subkey under:
[HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Perflib\009]. This is supposed to be
fixed by XPe SP2.

Burkhard

>-----Original Message-----
>Thanks for the reply, Phil.
[quoted text clipped - 76 lines]
>>
>.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.