Microsoft .Net Framework unhandled exception Category does not exist (Win Server 2019)

Rushdi Thabit 21 Reputation points
2022-01-08T10:47:49.117+00:00

Unhandled Exception: System.InvalidOperationException: Category does not exist.

at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)

at System.Diagnostics.PerformanceCounterCategory.GetCounterInstances(String categoryName, String machineName)

at System.Diagnostics.PerformanceCounterCategory.GetInstanceNames()

at SuperSocket.SocketEngine.PerformanceMonitor.GetPerformanceCounterInstanceName(Process process)

at SuperSocket.SocketEngine.PerformanceMonitor..ctor(IRootConfig config, IEnumerable`1 appServers, ILogFactory logFactory)

at SuperSocket.SocketEngine.DefaultBootstrap.Initialize(Func`2 serverConfigResolver, ILogFactory logFactory)

at SuperSocket.SocketEngine.DefaultBootstrap.Initialize(Func`2 serverConfigResolver)

at SuperSocket.SocketEngine.DefaultBootstrap.Initialize()

at SocketCommunicator.Program.RunAsConsole() in C:\EWE_EmployeeAttendanceApp\EWE_EmployeeAttendanceApp\SocketCommunicator\Program.cs:line 28

at SocketCommunicator.Program.Main(String[] args) in C:\EWE_EmployeeAttendanceApp\EWE_EmployeeAttendanceApp\SocketCommunicator\Program.cs:line 20

I have tired all the solutions available online. 1. uninstall and reinstall .net framework 2. update windows 2. Scan your computer for malware 3. Troubleshooting process 4. Install the .NET Framework manually 5. Run the .NET Framework repair tool 6. Perform SFC scanning 7. Clean Clean and access Safe Mode

note that the application only not working on one device, but working on other devices without any issues

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,904 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,168 questions
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. MotoX80 34,516 Reputation points
    2022-01-08T13:51:50.35+00:00

    at System.Diagnostics.PerformanceCounterCategory.GetCounterInstances(String categoryName, String machineName)
    at System.Diagnostics.PerformanceCounterCategory.GetInstanceNames()
    at SuperSocket.SocketEngine.PerformanceMonitor.GetPerformanceCounterInstanceName(Process process)

    That doesn't look like a DotNet problem. It looks like your program is trying to query a performance counter that does not exist.

    What is the program doing?

    If you run perfmon.exe can you view the counters that the program is querying?


  2. Rushdi Thabit 21 Reputation points
    2022-01-08T14:29:56.487+00:00

    163266-capture.jpg

    0 comments No comments

  3. MotoX80 34,516 Reputation points
    2022-01-08T14:42:02.42+00:00

    Looks like something has corrupted your performance counters. If you click on the green plus icon, does it show any counters?

    163297-capture.jpg

    https://learn.microsoft.com/en-us/troubleshoot/windows-server/performance/manually-rebuild-performance-counters

    Do you see errors in the application eventlog? You could try running the lodctr command to reload the counters.

    0 comments No comments

  4. Rushdi Thabit 21 Reputation points
    2022-01-08T14:44:04.583+00:00

    163384-capture2.jpg


  5. Rushdi Thabit 21 Reputation points
    2022-01-08T15:00:13.647+00:00

    163365-capture3.jpg

    this is capture from another machine


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.