当我使用的检查一个服务表现类别是否存在等
PerformanceCounterCategory.Exists("myCategory")
在系统上(全新安装XP SP3的),其中的类别并不存在。我得到抛出以下异常...
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)
不想责怪框架:)我究竟做错了什么?
编辑:检查性能对象列表之后-这是全数字的,而不是普通的文本-看起来像列表是腐败-去尝试这个KB