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

Problematic default value returned as the DeviceId #90

Open
kenkendk opened this issue Aug 30, 2024 · 0 comments
Open

Problematic default value returned as the DeviceId #90

kenkendk opened this issue Aug 30, 2024 · 0 comments

Comments

@kenkendk
Copy link

Try using the library with no sources supplied:

Console.WriteLine(new DeviceIdBuilder().ToString());

This returns the string WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG.

Of course, this is an incorrect way to use the library, but it is quite misleading that it returns a value that looks like a deviceId of sorts. In reality, the value is just hashing empty contents and returning this.

Another scenario where this happens is if the requested component is not working, for instance:

Console.WriteLine(
  new DeviceIdBuilder()
  .OnLinux(x => x.AddMotherboardSerialNumber())
  .ToString()
);

If the user does not have access to /sys/class/dmi/id/board_serial (or it does not exist) the result is again: WERC8GMRZGE196QVYK49JVXS4GKTWGF4CJDS6K54JPCHPY2JQ1AG.

For my uses, I have added this value as a "known bad value", but I think the library should return null or an empty string in this case, instead of returning a value that can be misinterpreted as a valid deviceId.

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

1 participant