mareek / UUIDNext

A fast and modern .NET library to generate UUID/GUID that are either sequential and database friendly (versions 7), name based (versions 5) or random (version 4).
BSD Zero Clause License
225 stars 13 forks source link

UUIDV7 ver and variant fields not filled in standards compliant way #17

Closed timstokman closed 2 weeks ago

timstokman commented 2 weeks ago

According to the standard:

I checked with other UUIDv7 generators (as in https://www.npmjs.com/package/uuidv7/v/0.5.3), and those libraries do fill those fields in a compliant way. Your library doesn't match. Might be a bit of a compatibility issue, makes it harder for libraries to recognize they're dealing with UUIDv7, might be compatibility issues.

.NET 9 also sets these fields correctly: https://github.com/dotnet/runtime/blob/039697860b0985bfaecd4e6d37e2968516daad9d/src/libraries/System.Private.CoreLib/src/System/Guid.cs

See Version7Value.

mareek commented 2 weeks ago

As far as I know, every UUID generated by UUIDNext have the correct version and variant bit set.

Can you provide some code examples where UUIDNext fails to set those bits ?

timstokman commented 2 weeks ago

I'm sorry, I think might've hit the sql server path somewhere, which doesn't generate UUIDv7. Sorry for wasting your time.

mareek commented 2 weeks ago

Ok, no problem.

Uuid.NewDatabaseFriendly(Database.SqlServer) generates UUID V8 which is the version for creating custom UUIDs