When I'm checking for the existance of a performace category using
PerformanceCounterCategory.Exists("myCategory")
on a system (clean install of XP SP3) where the category doesn't exist I'm getting the following exception thrown ...
Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, IFormatProvider provider)
at System.Diagnostics.PerformanceCounterLib.GetStringTable(Boolean isHelp)
at System.Diagnostics.PerformanceCounterLib.get_NameTable()
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.CategoryExists(String machine, String category)
at System.Diagnostics.PerformanceCounterCategory.Exists(String categoryName, String machineName)
at System.Diagnostics.PerformanceCounterCategory.Exists(String categoryName)
Not wanting to blame the framework :) what am I doing wrong?
EDIT: After checking the Performance Object list - it's full of numbers rather than the normal text - looks like the list is corrupt - going to try this KB