The performance counters of Windows NT. If Windows starts to try to remove the counters?

If you remove them, is it possible then that will depart the exception that the registry is something wrong and not be already again to create these same counters? I read on MSDN that it is not recommended to create the counters when you start Windows.

Or maybe when the counters not yet initialized, it cannot be removed? I understand that maybe the following happened: I booted the OS, my app tried to start the service (my app) to remove the counters and managed to do it, but apparently somehow not up to the end?

Here's the error when I try to delete the performance counters.
25 Jun 2016 10:00:00.5727|Error|Monitoring|||Execute|registry entry has the wrong value in the System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister)
 in System.Diagnostics.PerformanceCounterLib.UnregisterCategory(String categoryName)
 in System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName)
 in PerformanceMonitor.PerformanceCategory.DeleteIfExists()
 in PerformanceMonitor.MonitoringDispatcher.Initialize(Boolean recreateExistingCategories)
 in CustomServer.Threads.Monitoring.Execute()


These are my classes:
CustomServer.Threads.Monitoring
PerformanceMonitor.PerformanceCategory

So deleted and created counters:
_
 public bool DeleteIfExists()
{
 if (PerformanceCounterCategory.Exists(Name))
{
PerformanceCounterCategory.Delete(Name);
 return true;
}

 return false;
}

 public bool CreateIfNotExists()
{
 if (!PerformanceCounterCategory.Exists(Name))
{
 var counters = new CounterCreationDataCollection();
 foreach (PerformanceSet set in this.counterSets)
{
 foreach (CounterCreationDataExt creationData in set.CounterCreationData)
{
counters.Add(creationData);
}
}

 PerformanceCounterCategory.Create(Name, Description, CategoryType, counters);
 return true;
}

 return false;
 }
July 8th 19 at 11:31

Find more questions by tags .NETC#Performance evaluationProgrammingWindows