Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Management.ManagementException Monitor List on RDP #74

Open
Agent-JY opened this issue Sep 28, 2024 · 1 comment
Open

System.Management.ManagementException Monitor List on RDP #74

Agent-JY opened this issue Sep 28, 2024 · 1 comment

Comments

@Agent-JY
Copy link

0.9.3

Win 11 (64 bit)

Hardware.Info.HardwareInfo.RefreshMonitorList() throws an exeption when there is no monitor connected and the computer is controlled via RDP.

Code:

public class HardwareInformation
{
    private static readonly HardwareInfo HardwareInfo = new();

    public void GetInfo()
    {
        HardwareInfo.RefreshAll();
    }
}

Exception message:

System.Management.ManagementException: Not supported
   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
   at System.Linq.Enumerable.CastIterator[TResult](IEnumerable source)+MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Hardware.Info.Windows.HardwareInfoRetrieval.GetMonitorList()
   at Hardware.Info.HardwareInfo.RefreshMonitorList()
   at Hardware.Info.HardwareInfo.RefreshAll()
@Jinjinov
Copy link
Owner

Thank you for reporting this!

I will take a look when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants