Some weird error message with Performance Counter...!!! RRS feed

  • Question

  • Hi,

    I have been using Performance counters in my C# application for my test cases. It works fine most of the time but intermittently I have been getting following error weird message and I have no clue from where and why it has been arising. Could anyone please help me what's going on?

    System.InvalidOperationException : The Counter layout for the Category specified is invalid, a counter of the type:  AverageCount64, AverageTimer32, CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, CounterMultiTimer100NsInverse, RawFraction, or SampleFraction has to be immediately followed by any of the base counter types: AverageBase, CounterMultiBase, RawBase or SampleBase.   



    Code FTR:


      PerformanceCounter pc = new PerformanceCounter();
      pc.CategoryName = "SQL Server:Databases"

      pc.CounterName = "Transactions/sec";

      pc.InstanceName = "MyDatabase";

      pcVal = pc.NextValue();

    • Moved by SamAgain Monday, November 8, 2010 2:32 AM (From:Building Development and Diagnostic Tools for .Net)
    Friday, November 5, 2010 11:33 AM

All replies