none
PerformanceCounterCategory.Exists error RRS feed

  • Question

  • I am getting FormatException when calling PerformanceCounterCategory.Exists("XYZ") -> "Input string was not in a correct format."

    I have read somewhere that this should be a regional setting issue, I have tried to change and return back but without success.
    Are there any news regarding this issue ?

    I am using: Win XP Professional SP3, .NET Framework 3.5 SP1, VS 2008.

    Thanks for your help
    JT


    The callstack is:
       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)

    Monday, November 16, 2009 11:01 PM

Answers

  • Hi,

    Could you please check the registry key

       HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter

    to see whether it contains any invalid integer numbers?

     

    Thanks,

    Eric


    Please remember to mark helpful replies as answers and unmark them if they provide no help.
    • Marked as answer by eryang Wednesday, November 25, 2009 9:40 AM
    Thursday, November 19, 2009 7:30 AM
  • This could help you manually rebuild performance counter library values: http://support.microsoft.com/kb/300956

    -Karel
    • Marked as answer by eryang Wednesday, November 25, 2009 9:40 AM
    Monday, November 23, 2009 4:55 PM
    Moderator

All replies

  • Hi,

    Could you please check the registry key

       HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter

    to see whether it contains any invalid integer numbers?

     

    Thanks,

    Eric


    Please remember to mark helpful replies as answers and unmark them if they provide no help.
    • Marked as answer by eryang Wednesday, November 25, 2009 9:40 AM
    Thursday, November 19, 2009 7:30 AM
  • Hi,
    Thanks for your tip.

    However I am a bit puzzled. When I try to modify the Counter data I see kB's of zeros until an listing error occurs, see below:

    offset: data:
    ...
    FFE0   00 00 00 00 00 00 00 00
    FFE8   00 00 00 00 00 00 00 00
    FFF0   00 00 00 00 00 00 00 00
    FFF8   00 00 00 00 00 00 00 00  <-- still correct
    1000  00 00 00 00 00 00 00 00  <-- from here all rows duplicated !!!
    1000  00 00 00 00 00 00 00 00
    1001  00 00 00 00 00 00 00 00
    1001  00 00 00 00 00 00 00 00
    ...

    Oh I understand, the offset misses the first digits -> 10000, 10008, 10010, 10018, etc... So at least formatting error here.

    But how the data should look like ?

    May I somehow reset this Perflib\009\Counter value or use some validation tool ?
    JT

    Friday, November 20, 2009 1:48 PM
  • This could help you manually rebuild performance counter library values: http://support.microsoft.com/kb/300956

    -Karel
    • Marked as answer by eryang Wednesday, November 25, 2009 9:40 AM
    Monday, November 23, 2009 4:55 PM
    Moderator
  • Many thanks for a tip, I did rebuild performance counters from perfc009.dat + perfh009.dat files.
    PerformanceCounterCategory.Exists method now works correctly..

    I just noticed 2 logged errors related to counters:
    1) The Sql Server Express was unable to read 'First Counter' value from registry.
        To be sure I reinstalled SQL Express.
    2) Something wrong with Windows Indexing Service:
       "Could not get performance counter registry info for WSearchIdxPi for instance due to the following error: The operation completed successfully.   0x0."

    I would be interested on any tip how to remove the Window Search Indexing error.

    I wait some time if some advice come, in a few days I will mark this issue as Answered.
    JT

    Wednesday, November 25, 2009 1:40 PM
  • Neither #1 nor #2 are CLR questions (and neither is the original question). Please use appropriate forums/newsgroups to follow up on those 2 issues.
    For #2 that could be http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchhelp/threads

    -Karel

    BTW: The issue is already marked as Answered.

    Wednesday, November 25, 2009 5:26 PM
    Moderator