System.Management.ManagementException "Unsupported display" in my virtual machine

Copper Contributor
 

When running my program in my virtual machine for some kind of reason it fails to fetch the display information:

var success = true;

List<Display> displays = new List<Display>();

// Query WmiMonitorBasicDisplayParams to retrieve display parameters
using (var searcher = new ManagementObjectSearcher(@"Root\WMI", "SELECT * FROM WmiMonitorBasicDisplayParams"))
using (var results = searcher.Get())

Here at the result variable if the program is not run in a virtual machine I obtain the result object, otherwise in my vmware machine I obtain the following exception (I'm currently running the program on Windows 10):

Unhandled exception. System.Management.ManagementException: Not supported

at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at

System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()

 

0 Replies