question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid Class exception when using RefreshCPUList method

See original GitHub issue

Library version

10.0.1.1

OS & OS version

Windows 10 x64 21H2 build 19044

Describe the bug

RefreshCPUList() method occurs the InvalidClass exception

To Reproduce

internal static class Program {
    static readonly IHardwareInfo HardwareInfo = new HardwareInfo();
    
    public static void Main() {
        HardwareInfo.RefreshMemoryStatus();
        HardwareInfo.RefreshCPUList(); // Exception
        
        Console.WriteLine(HardwareInfo.MemoryStatus);
        HardwareInfo.CpuList.ForEach(Console.WriteLine);
    }
}

Steps to reproduce the behavior:

  1. Open Visual Studio and create a new ConsoleApplication
  2. Add the code above
  3. Run the program

Exceptions

Unhandled exception. System.Management.ManagementException: Invalid class at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() at Hardware.Info.Windows.HardwareInfoRetrieval.GetCpuList(Boolean includePercentProcessorTime) at Hardware.Info.HardwareInfo.RefreshCPUList(Boolean includePercentProcessorTime) at ConsoleApp1.Program.Main() in C:\Users\Stm07\Desktop\ConsoleApp1\Program.cs:line 10

Expected behavior

Writing CPU info to the console

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
C6OIcommented, Oct 3, 2022

Oh, I didn’t notice that I didn’t write about it. I tried changing IHardwareInfo hardwareInfo = new HardwareInfo(useAsteriskInWMI: false);, but the program also crashes.

Sorry, but I’m not at the computer now, I can try to debug it tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Getting InvalidClassException while using newer ...
I have a class InvalidClassException with serial version id private static final long serialVersionUID = -5086279873877116405L;.The old value ...
Read more >
InvalidClassException (Java Platform SE 8 )
public class InvalidClassException extends ObjectStreamException. Thrown when the Serialization runtime detects one of the following problems with a Class.
Read more >
Invalid Class Exception during serialization
When i try to send the list along with the object then it gives me an exception :. Am i missing something ?....
Read more >
Error in serialization java.io.InvalidClassException
hi i came across this error when i serialized classes while using a JMS Service. This error occurred at the time when the...
Read more >
V6087. InvalidClassException may occur during ...
The analyzer has detected a situation where the absence of an available default constructor during deserialization may lead to a ′java.io.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found