How to Fix User Code Host Service error- PDH_INVALID_HANDLE

This is very comman error when we start the Microsoft SharePoint Foundation Sandboxed Code Service in Central Admin  then it appears to start fine, however in Services.msc the SharePoint 2010 User Code Host is not started. if you check the logs the error mentions PDH_INVALID_HANDLE.

SharePoint 2010 User Code Host service terminated unexpectedly - Call failed with error code PDH_INVALID_HANDLE.

Then it does not point any specific configuration is missing.  afte tring all suggestion found over internet , i would have ended with no solution which could fixe this issue. Then i started taking server logs and found that ASP.NET performance counter control  is coming every time when this issue occured. after debugging , I found that .

There is one bat file “perfc009”  on C:\Windows\System32,  which was empty on these server and which should contains ASP.NET performance counter control (those were disabled./not added properly ).
Solution was one line,

Just  Go to Run and run this command,
“lodctr /r”,  thats all , it will reset/load all asp.net performance control. Issue got fixed and service started and running fine..

Sharing this information as i had to spend quite to time to fix this. happy learning !