Search code examples
c#.netmonitoringopenhardwaremonitor

How to use OpenHardwareMonitor .dll?


I'm trying to get status data of my processor on the local machine. I found several tutorials online, but no one of them covers the error I'm getting.

This is my code:

        UpdateVisitor visitor = new UpdateVisitor();

        Computer computer = new Computer();
        computer.Open();
        computer.CPUEnabled = true;

        computer.Accept(visitor);

It throws an Exception when calling computer.Open() and this is the exception message:

enter image description here

What am i doing wrong? If i can provide some more detail, please let me know. I'm referencing the library in a .NET Standard 2.0 project.


Solution

  • Solved the problem by referencing the library in a .NET Framework 4.7.1 project, instead that in a .NET Standard 2.0 project. I post this answer just to warn other people trying to achieve this that this library is not fully compatible with .NET Standard code.