При использовании System.Diagnostics.PerformanceCounter я получаю следующее исключение. Не знаю почему:
private void CheckCurrentMemoryUsage()
{
using (var counter = new PerformanceCounter("Memory", "Available MBytes"))
{
CurrentMemoryUsage = GetCurrentMetric(counter);
if (CurrentMemoryUsage < 100)
{
OnThresholdReached(new PerformanceMetricsEventArgs(PerformanceMetricsType.Memory, CurrentMemoryUsage));
}
if (CurrentMemoryUsage > 100)
{
OnBelowThreshold();
}
}
}
System.IO.FileNotFoundException: 'Could not load file or assembly
'System.Diagnostics.PerformanceCounter, Version=4.0.1.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
The system cannot find the file specified.