Invalid Class exception when using RefreshCPUList method
See original GitHub issueLibrary 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:
- Open Visual Studio and create a new ConsoleApplication
- Add the code above
- 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:
- Created a year ago
- Comments:9 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in https://github.com/Jinjinov/Hardware.Info/releases/tag/v10.1.0.0
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.