
Untitled
By: a guest on
Jul 18th, 2012 | syntax:
None | size: 0.88 KB | hits: 12 | expires: Never
InvalidOperationException when creating PerformanceCounter
namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
PerformanceCounter ramCounter = new PerformanceCounter("Memory", "Available Bytes");
}
}
}
Unhandled Exception: System.InvalidOperationException: Category does not exist.
at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean
readOnly)
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName)
at TestConsole.Program.Main(String[] args) in D:ProjektarbeitBachelorarbeitVS2010ProjekteDiagStationControllerTe
stConsoleV1TestConsoleProgram.cs:line 15