Skip to content

Commit 2db48f5

Browse files
committed
fix: use BitConverter for hex conversion to support .NET 8
Convert.ToHexStringLower() is only available in .NET 9+. Reverted to BitConverter.ToString().Replace("-", "").ToLowerInvariant() for compatibility with .NET 8. Signed-off-by: Joseph Brinkman <[email protected]>
1 parent 469be6e commit 2db48f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sources/Valkey.Glide/BaseClient.ScriptingCommands.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ public async Task<ValkeyResult> ScriptEvaluateAsync(byte[] hash, ValkeyKey[]? ke
377377
{
378378
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
379379

380-
// Convert hash to hex string
381-
string hashString = Convert.ToHexStringLower(hash);
380+
// Convert hash to hex string (lowercase)
381+
string hashString = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
382382

383383
// Convert keys and values to string arrays
384384
string[]? keyStrings = keys?.Select(k => k.ToString()).ToArray();
@@ -437,7 +437,7 @@ public async Task<ValkeyResult> ScriptEvaluateAsync(LoadedLuaScript script, obje
437437

438438
// Convert the hash from byte[] to hex string
439439
// The hash in LoadedLuaScript is the hash of the script that was actually loaded on the server
440-
string hashString = Convert.ToHexStringLower(script.Hash);
440+
string hashString = BitConverter.ToString(script.Hash).Replace("-", "").ToLowerInvariant();
441441

442442
// Use InvokeScriptInternalAsync with the hash from LoadedLuaScript
443443
// The script was already loaded on the server, so EVALSHA will work

0 commit comments

Comments
 (0)