Windows: Cannot change thread mode after it is set issue
Hi, I keep getting an error when trying to get any system info.
I've ran the following piece of code with Memory, CPU, GPU and I get the same error:
Code:
memory, err := ghw.Memory() if err != nil { panic(err) }
Error:
panic: Cannot change thread mode after it is set.
The only one which seems to be working is ghw.Topology()
I'm running go 1.17 on Windows 10, any help would be appreciated.
Hi @mlugo2! Sorry for the delayed response!
Unfortunately, I don't know why that error would show up for you on Windows10/go1.17. I've Googled for the error and I see it show up in a number of libraries where DLLs are being loaded. ghw uses the github.com/StackExchange/wmi library for calling the Windows Management Instrumentation (WMI) interfaces. Apparently that library is no longer being maintained and depends on a slightly older version of the github.com/go-ole/go-ole (v1.2.5). There is a new version of github.com/go-ole/go-ole (v1.2.6) that may have a fix for the thread mode issue.
It may take me a bit, but I will try to add an updated dependency to github.com/go-ole/go-ole v1.2.6 before we hit 1.0.
We have a CI lane which runs on windows; unfortunately, no win10 is available - we just use what GH make available. I wonder if there is a way to reproduce this issue in our CI.