Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#14021·semantic-kernel

.Net: Bug: .NET: RedisJsonCollection JSON upsert includes unannotated POCO properties

Author: danyalahmed1995Created May 17, 2026Updated Sep 29, 2026
Labelsbug.NETtriagestale

Description

RedisJsonCollection<TKey, TRecord> currently includes unannotated public POCO properties when writing Redis JSON payloads during upsert.

RedisJsonMapper<T> serializes the whole record with JsonSerializer.SerializeToNode(...), removes only the key property, then adjusts vector fields. This means public properties that are not part of the vector-store model still get persisted into the Redis JSON payload.

I noticed the current Redis JSON unit tests already contain TODOs for this behavior:

csharp
// TODO: Fix issue where NotAnnotated is being included in the JSON.

The current expected JSON.SET / JSON.MSET payloads include the unannotated property, for example:

json
{"data1_json_name":"data 1","Data2":"data 2","vector1_json_name":[1,2,3,4],"Vector2":[1,2,3,4],"NotAnnotated":null}

Why I am opening this

I wanted to check whether this is intended behavior or a known issue that still needs tracking.

The Redis JSON connector documentation currently says JSON storage serializes all properties except the key, but the local test TODO suggests this may not be the desired final behavior for vector-store model mapping.

Repro

From a clean checkout:

powershell
$dotnet = Join-Path $env:TEMP 'dotnet-10-sdk\dotnet.exe'
& $dotnet test dotnet\test\VectorData\Redis.UnitTests\Redis.UnitTests.csproj --filter "FullyQualifiedName~RedisJsonCollectionTests.CanUpsertRecordAsync" --verbosity normal

The test passes because the expected Redis JSON payload currently includes the unannotated property.

Current behavior

Unannotated public POCO properties are persisted into Redis JSON payloads.

Expected behavior, if the TODO reflects intended behavior

Redis JSON upsert should only persist the vector-store model fields:

  • key used as the Redis key, not included in the payload
  • [VectorStoreData] properties
  • [VectorStoreVector] properties

Unannotated public properties should not be included.

Environment

Repo commit: 2fb749e4b SDK used for local test run: .NET 10.0.300 OS: Windows 10 x64

Possible fix direction

If the intended behavior is to exclude unannotated properties, RedisJsonMapper<T> could build the JSON object from model.DataProperties and model.VectorProperties, similar to the dynamic mapper path, instead of serializing the full POCO and removing only the key.

If the current behavior is intended for Redis JSON mode, then the TODO in the tests may just need to be removed or clarified.

Source: microsoft/semantic-kernel

View original on GitHubView discussion on GitHub