When I use System.Diagnostics.PerformanceCounterCategory.GetInstanceNames call, I always get 0 instances returned the first time. If I actually query for a counter value first (using perfmon) and then call GetInstanceNames, it works fine. Can someone provide some insight? Do I need to get a counter value first (in code) and then use the GetInstanceNames?
When I use System.Diagnostics.PerformanceCounterCategory.GetInstanceNames call, I always get 0 instances returned the first time.
Share
I found the answer. I added a call to System.Diagnostics.PerformanceCounterCategory.ReadCategory before trying GetInstances. That seems to fixed the issue I was seeing.