Search code examples
c#windows.net-coreetw

Performance counters compatibility with .Net Core


Is there any nuget packages or helpers for controlling custom performance counters in .Net Core? I'm using System.Diagnostics.PerformanceCounter package.

Visual Studio has PerfWatson2 (Developer Analytics Tools) extension which runs when debugging so I'm able to change counters values.

But if I install that code as a service on that machine and start it, Performance counters values does not change (always zero). Service user is added to "Performance Monitor Users".

If I add service user to "Administrators" group. Then performance counters works.

Maybe "Performance Monitor Users" group is not working with .Net Core? I don't want to run service with admin rights because of performance counters.

Tried Microsoft.Windows.Compatibility nuget package but still no luck.. https://blogs.msdn.microsoft.com/dotnet/2017/11/16/announcing-the-windows-compatibility-pack-for-net-core/


Solution

  • This problem is resolved - a fix has been merged onto https://github.com/dotnet/runtime.