From 5d890dae20930917533a811ed5cd37aba550818a Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Mon, 1 Jun 2026 18:27:42 +0100 Subject: [PATCH] Fix NET 8 CreateVersion7 polyfill RFC 9562/IETF variant bits Set correct UUID variant bits in uuidBytes array Updated manipulation of the 9th byte in uuidBytes to mask with 0x3F and set the two highest bits to '10', ensuring compliance with the UUID variant specification. --- src/Polyfill/GuidPolyfill.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Polyfill/GuidPolyfill.cs b/src/Polyfill/GuidPolyfill.cs index 23896306..90a389ea 100644 --- a/src/Polyfill/GuidPolyfill.cs +++ b/src/Polyfill/GuidPolyfill.cs @@ -60,6 +60,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) uuidBytes[6] &= 0x0F; uuidBytes[6] += 0x70; + uuidBytes[8] &= 0x3F; + uuidBytes[8] += 0x80; + return new(uuidBytes, true); #else