Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HybridCache returning null when using Poly.Outcome return type #5685

Open
tivik7 opened this issue Nov 22, 2024 · 0 comments
Open

HybridCache returning null when using Poly.Outcome return type #5685

tivik7 opened this issue Nov 22, 2024 · 0 comments
Labels
area-caching-hybrid bug This issue describes a behavior which is not expected - a bug. untriaged

Comments

@tivik7
Copy link

tivik7 commented Nov 22, 2024

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

@tivik7 tivik7 added bug This issue describes a behavior which is not expected - a bug. untriaged labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-caching-hybrid bug This issue describes a behavior which is not expected - a bug. untriaged
Projects
None yet
Development

No branches or pull requests

2 participants