I've been creating EXE/Script Advanced sensors for PRTG in C# for some months now and I'm having trouble whenever I need to get Performance Counters values within my code.
The strange thing is that most of the times everything works fine, but sometimes some weird exceptions occur, such as:
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. at System.Diagnostics.CategorySample.GetCounterDefinitionSample(String counter) at System.Diagnostics.PerformanceCounter.NextSample() at System.Diagnostics.PerformanceCounter.NextValue()
A code example: https://pastebin.com/s4b7p1JA
These sensors run simultaneously on different PRTG devices (i.e. different host IPs/names).
Is this something you can help me with?
Thanks in advance.