Researching the subject yesterday, I found several interesting questions (such as this one) on how GUIDs are ultimately generated. In brief; it seems that Guid.NewGuid();
calls CoCreateGuid
in the COM, which in turn calls UuidCreate
in the Windows RPC (docs here and here).
I found myself wondering; How does this work when the OS is not Windows, such as might be the case with .NET Core, and does this affect the 'version' algorithm used to generate the GUID (which I understand is Version 4 on Windows)?
On non-windows machines, .NET Core will use either uuid_create
on BSD (which is "version 1") or libuuid's uuid_generate_random
function on macOS and linux ("version 4").
The implementation for the replacement CoCreateGuid
function can be found in CoreCLR's source code on GitHub.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With