9

When I try to run this code:

var categories = System.Diagnostics.PerformanceCounterCategory.GetCategories();

I get an ArgumentException exception.

I already tried the following with no luck:

  • How to manually rebuild Performance Counter Library http://support.microsoft.com/kb/300956
  • lodctr /R
  • Logged in as a local administrator.
  • Disabled User Access Control (UAC)
  • Made my user member of the Performance Monitor Users group.

I get the same result whether I run Visual Studio 2008, 2010 or 2012, on a Windows 7 Enterprise SP1 64-bit computer.

I will appreciate any help.

Thank you.

1 Answers1

13

Had the same problem.

This was on a machine that had an NVidia Quadro 2000 card.

Uninstalling the "NVidia WMI" product solved the issue... :)

RnR
  • 2,096
  • 1
  • 15
  • 23
  • Good to know it's not just us but man did learn it the hard way... :) – RnR Dec 10 '13 at 20:59
  • nice, but how did you find out...? – treehouse May 21 '15 at 03:56
  • It's a long story - we have a performance regression framework and it uses the windows performance counters. We used it with AMD cards without problems, but we've seen problems with NVidia from time to time. We were unable to track it down, we stayed with AMD and the working NVidia setups. Once upon a time we had it work once just to stop working the next hour immediately after a colleague updated the drivers so I started to connect the dots and realized that in the manual setup for the drivers that I always used we have those "garbage" options I used to uncheck when installing them... :) – RnR May 25 '15 at 15:07
  • 1
    2018 and this is still a problem - I had something named "NVIDIA WMI 2.20.0", and after uninstalling it the a powershell call to `[Diagnostics.PerformanceCounterCategory]::GetCategories()` stopped failing. – Anssssss Feb 26 '18 at 22:23