Cannot load Counter Name data because an invalid index -Exception

I am using C# and WPF - Operating System is windows 7 Professional and Visual Studio 2012, SQL Server 2012.

I used Devexpress Grid in wpf. I want to bind it to database using ADO.Net Server mode. I selected "Items Source Wizard" Option to do this binding but it generated following Exception:

InvalidOperationException: Cannot load Counter Name data because an invalid index '' was read from the registry.

What does this exception mean?

Can you please help me to resolve this issue.

Thanks, Annie.


Although this has already been answered, I see people are repeatedly getting the same error that I did when trying to solve it. If when you run:

C:\windows\system32> lodctr /r

you get the error

Error: Unable to rebuild performance counter setting from system backup store, error code is 2

then you instead need to run

C:\windows\SysWOW64> lodctr /r

after which you should get

Info: Successfully rebuilt performance counter setting from system backup store

Note this has to be done as administrator. I found the solution here


Just had that message related to Microsoft Dynamics CRM updates not installing and the marked answer for this post helped greatly:

Click Start, type cmd right click cmd.exe, and select Run as administrator. At the prompt, type lodctr /r and press ENTER.

Apparently, Windows keeps some counters cache in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009 \ Counter+Help. If this cache becomes corrupted (has blank lines), you get the above errors - and lodctr /r rebuilds that cache.