diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 0ad00222b..591d1ca25 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -6,6 +6,10 @@ Current package versions: | ------------ | ----------------- | ----- | | [![StackExchange.Redis](https://img.shields.io/nuget/v/StackExchange.Redis.svg)](https://www.nuget.org/packages/StackExchange.Redis/) | [![StackExchange.Redis](https://img.shields.io/nuget/vpre/StackExchange.Redis.svg)](https://www.nuget.org/packages/StackExchange.Redis/) | [![StackExchange.Redis MyGet](https://img.shields.io/myget/stackoverflow/vpre/StackExchange.Redis.svg)](https://www.myget.org/feed/stackoverflow/package/nuget/StackExchange.Redis) | +## unreleased + +- Fix incorrect debug assertion in `HGETEX` (no impact to release library) ([#2999 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2999)) + ## 2.10.1 - Support Redis 8.4 CAS/CAD operations (`DIGEST`, and the `IFEQ`, `IFNE`, `IFDEQ`, `IFDNE` modifiers on `SET` / `DEL`) diff --git a/src/StackExchange.Redis/RedisDatabase.cs b/src/StackExchange.Redis/RedisDatabase.cs index f13571c4e..c1c3c5728 100644 --- a/src/StackExchange.Redis/RedisDatabase.cs +++ b/src/StackExchange.Redis/RedisDatabase.cs @@ -507,10 +507,9 @@ private Message HashFieldGetAndSetExpiryMessage(in RedisKey key, RedisValue[] ha return HashFieldGetAndSetExpiryMessage(key, in hashFields[0], expiry, flags); } - // precision, time, FIELDS, hashFields.Length + // precision, time, FIELDS, hashFields.Length, {N x fields} int extraTokens = expiry.TokenCount + 2; - - RedisValue[] values = new RedisValue[expiry.TokenCount + 2 + hashFields.Length]; + RedisValue[] values = new RedisValue[extraTokens + hashFields.Length]; int index = 0; // add PERSIST or expiry values @@ -528,7 +527,7 @@ private Message HashFieldGetAndSetExpiryMessage(in RedisKey key, RedisValue[] ha values[index++] = RedisLiterals.FIELDS; values[index++] = hashFields.Length; // check we've added everything we expected to - Debug.Assert(index == extraTokens + hashFields.Length); + Debug.Assert(index == extraTokens, $"token mismatch: {index} vs {extraTokens}"); // Add hash fields to the array hashFields.AsSpan().CopyTo(values.AsSpan(index));