Performance Counters Registry validation
Posted
by anchandra
on Stack Overflow
See other posts from Stack Overflow
or by anchandra
Published on 2010-03-22T22:04:21Z
Indexed on
2010/03/22
22:21 UTC
Read the original article
Hit count: 341
I have a C# application that adds some performance counters when it starts up. But if the registry HKEY_LOCAL_MACHINE->SOFTWARE->Microsoft->Windows NT->CurrentVersion->Perflib is corrupted (missing or invalid data), the operation of checking the existence of the performance counters (PerformanceCounterCategory.Exists(category) takes a really long time (around 30 secs) before finally throwing exception (InvalidOperation: Category does not exist).
My question is how can i verify the validity of the registry before trying to add the performance counters (and what validity means) or if there is a way i can timeout the perf counter operations, so that it doesn't take 30 seconds to get an exception.
© Stack Overflow or respective owner