Every hour on the hour, on all the servers in the farm running the Microsoft SharePoint Foundation Sandboxed Code Service, the following event is written to the system log event 7034:
Source: Service COntrol Manager Event ID: 7034 Level: Error
"The SharePoint 2010 User Code Host service terminated unexpectedly. It has done this .. time(s)."
At the same moment you can also observe an error message in the ULS logs:
"Performance Counter OS (pdh) call failed with error code PDH_INVALID_DATA"
ProcessNameFormat in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance; Data value has been set to 2 to show a PID in Performance Monitor.
When the service is started, it verifies its performance counters were registered correctly. If the option was set in the registry to include a PID in the process name this verification fails.
Set the data value of ProcessNameFormat in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance to 1
ProcessNameFormat in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance; Data value can be set to 2 in order to get a PID showing in Performance Monitor tracing. This value however should not be left set all the time or you will see the 7034 Event ID.