dotnet / dotnet/extensions

HybridCache handling Newtonsoft types

Open
#6,527 1 comment 0 reactions 0 assignees View on GitHub
area-caching-hybrid bug
Dominant language
C#
Stars
3.2k
Forks
894
Avg merge
1d 12h
Merged PRs (30d)
23

Description

### Description

Items retrieved from Cosmos can contain JArray/Jobject, when the items are put into Hybrid cache the (de)serialization goes wrong

### Reproduction Steps

1. Create a class:
```c#
public class Demo
{
public string Id { get; set; }
public Dictionary Settings { get; set; } = new();
}
```

2. Store a json object in Cosmos:
```json
{
"id": "abc",
"settings": {
"abc": [ {"id": 1 }, {"id": 1 }]
}
}
```

3. Retrieve the item from Cosmos and store in hybrid cache

4. Retrieve item from hybrid cache

### Expected behavior

Unsure

### Actual behavior

The JArray/JObject objects are incorrectly (de)serialized.

### Regression?

no

### Known Workarounds

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.