Closed tbeattie63 closed 7 months ago
Exact same issue here. I think if getting the drive serial number (or any other id) can fail, the component should return null.
Thank you both for the report. This will be fixed in the next release. This project doesn't currently have the resources to diagnose environment-specific permissions issues, so instead I'm just going to catch any exceptions here and have the component return null.
If you need the fix earlier than next release, you can just copy+paste the contents of the updated MmiSystemDriveSerialNumberDeviceIdComponent.cs
file into your own project, give it a new name, and add it using the DeviceIdBuilder.AddComponent
Thanks. That's fine for me - my workaround was to wrap the existing component in an own one simply catching the exception.
In my case the problem happened on a standalone machine. Probably caused by a consumer security suite or a corrupted WMI. Wasn't able to investigate that further and the workaround did the job.
Using DeviceId 6.4.0, Device.Windows.Wmi 6.5.0
Possibly caused by locked down permissions on corporate network.
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() at System.Linq.Enumerable.d95`1.MoveNext()
at DeviceId.Windows.Wmi.Components.WmiSystemDriveSerialNumberDeviceIdComponent.GetValue()
at DeviceId.Formatters.HashDeviceIdFormatter.<>c.b 4_1(KeyValuePair
2 x) at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable
1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at DeviceId.Formatters.HashDeviceIdFormatter.GetDeviceId(IDictionary
2 components)