I am trying to enumerate all instance names for a PerformanceCounterCategory
by using PerformanceCounterCategory.GetInstanceNames()
method and getting below exception:
Load factor needs to be between 0.1 and 1.0.
Parameter name: loadFactor
EXCEPTION: System.ArgumentOutOfRangeException
at System.Collections.Hashtable..ctor(Int32 capacity, Single loadFactor)
at System.Diagnostics.CategorySample..ctor(Byte[] data, CategoryEntry entry, PerformanceCounterLib library)
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String category)
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
at System.Diagnostics.PerformanceCounterCategory.GetCounterInstances(String categoryName, String machineName)
at System.Diagnostics.PerformanceCounterCategory.GetInstanceNames()
at Abc.Xyz.Utilities.PerfCounter.InitCounter()
I already checked for Performance counter category and it exists.
Any suggestions?