private static bool TryAddCounter(string categoryName, string counterName, string instanceName) { try { var c = new PerformanceCounter(categoryName, counterName, instanceName, true); _perfomanceCounters.TryAdd(c.HashForCounter(), c); return true; } catch { return false; } }