How to fix .NET Framework performance counter problems in XP Embedded

I posted this item a while back in the newsgroups but I wanted to put it in my blog also because I think it may have gotten a little buried amongst all the posts there.  We have seen many reports of bugs related to calling into performance counter APIs on XP Embedded.  These have shown up most commonly when using the System.Diagnostic.Process class in the .NET Framework but can also be seen when using certain native APIs.  The underlying issue is a registry key that is incorrectly populated when creating an XP Embedded image.  This issue will be fixed in the upcoming XP Embedded SP2 release, but I
also wanted to provide a couple of workarounds that can be applied in the

If you have not yet built your XP Embedded runtime, you can do the

  1. Choose all of the components you want in your runtime and check dependencies in Target Designer
  2. Go to the View menu and make sure the Resources item is checked
  3. Expand the Performance Counter Configuration component in the component viewer for your runtime and choose Registry Data
  4. Right-click on the key named HKLM\Software\Microsoft\Windows NT\CurrentVersion\Perflib\009\ and choose Disable
  5. Build your runtime with that key disabled so it will not appear by default

If you have already built your runtime, you can delete the registry key named HKLM\Software\Microsoft\Windows NT\CurrentVersion\Perflib\009\ and then reboot your machine to fix this issue.


Comments (4)

  1. CCStewart says:

    Well done. This was a great help.

  2. Eric says:

    I am using xpe sp2 and when I try to delete the registery key I am not allowed, but my permissions are set to full control.

  3. Hi Eric – there might be another process holding the registry key/value in use if you try to delete it from a running OS. You might want to try the other set of steps to boot into a safe OS and load the registry hive and delete the registry key/value that way instead.

    Hope this helps!

  4. Dave says:

    Helped me out, also.  Great tip!

Skip to main content