Open jo185104 opened 1 year ago
It looks like the problem is in the dotnet runtime. I had installed .NET SDK 7.0.102. When I updated it to the current version .NET SDK 7.0.200 the problem still exists. It seems to me that they have problems with this call over the years.
https://github.com/dotnet/runtime/issues/21430#issuecomment-1160762782
Good catch, and great issue report, thanks. I'll push out an immediate fix for the unexpected exception, and pencil in some future investigation to find a proper workaround.
Hello,
we use DeviceId in docker. It works in a Linux container, but not in a Windows container. You support AddDockerContainerId for DeviceId.Linux in the README file. Do you also support Windows containers?
I found the problem where it fails is on this line: https://github.com/MatthewKing/DeviceId/blob/6be01e121f8247203fda38255272c2dcca229bf4/src/DeviceId.Windows.Wmi/Components/WmiSystemDriveSerialNumberDeviceIdComponent.cs#L23
Environment.SpecialFolder.System returns "System" Environment.GetFolderPath(Environment.SpecialFolder.System) returns an empty string so Substring(0, 2) fails.
Failure with this code:
Stack Trace:
Probably the same problem here: https://github.com/MatthewKing/DeviceId/blob/9c8124579fc1a075df7ff2d26e73412d6ec6af58/src/DeviceId.Windows.Mmi/Components/MmiSystemDriveSerialNumberDeviceIdComponent.cs#L22
Thank you in advance for your feedback.