HybridCache returning null when using Poly.Outcome return type
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
### Description
When encapsulating a return using Poly.Outcome from the resilience framework in hybridcache, the Result return is always null. MemoryCache returns the correct response.
### Reproduction Steps
var hybridTest = await _hybridCache.GetOrCreateAsync("hybridtest", async (entry) =>
{
return Outcome.FromResult("Test");
});
var memoryTest = await _memoryCache.GetOrCreateAsync("memorytest", async (entry) =>
{
return Outcome.FromResult("Test");
});
### Expected behavior
hybridTest.Result should read "Test"
memoryTest.Result should read "Test"
### Actual behavior
hybridTest.Result is null
memoryTest.Result is "Test"
### Regression?
_No response_
### Known Workarounds
Not necessarily a workaround, but dropping the Poly.Outcome wrapping i.e:
var hybridTest = await _hybridCache.GetOrCreateAsync("hybridtest", async (entry) =>
{
return Outcome.FromResult("Test").Result;
});
Gives hybirdTest == "Test", but you are missing the Outcome wrapping
### Configuration
.Net 9.0.100
"Microsoft.Extensions.Caching.Hybrid" Version="9.0.0-preview.9.24507.7"
"Microsoft.Extensions.Caching.Memory" Version="9.0.0"
"Microsoft.Extensions.Resilience" Version="9.0.0"
Macbook Pro, Apple M1 Max, Sequoia 15.1.1
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.