ArgumentException while OutputCache is cached
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
Hi,
I got error message in log while i swear my endpoint output is cached
Any how I can find what the cause of this exception?
Moved from https://github.com/StackExchange/StackExchange.Redis/issues/2732
### Expected Behavior
- No exception at all
- A way to debug the exception? log the key for example
- Or simply warn, this key is null instead of throwing exception
### Steps To Reproduce
- The code is nothing fancy
It is based on example https://learn.microsoft.com/en-us/aspnet/core/performance/caching/output?view=aspnetcore-8.0
- New custom policy
- VaryByQuery *
- VarByHeader Authorization
- I removed part where if there is Authorization, do not cache (which mean I do need to cache authorized request)
- I used yarp
### Exceptions (if any)
System.ArgumentException: A null value is not valid in this context
at StackExchange.Redis.RedisValue.AssertNotNull() in /_/src/StackExchange.Redis/RedisValue.cs:line 308
at StackExchange.Redis.RedisDatabase.ScriptEvalMessage..ctor(Int32 db, CommandFlags flags, RedisCommand command, String script, Byte[] hexHash, RedisKey[] keys, RedisValue[] values) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 4814
at StackExchange.Redis.RedisDatabase.ScriptEvalMessage..ctor(Int32 db, CommandFlags flags, RedisCommand command, String script, RedisKey[] keys, RedisValue[] values) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 4790
at StackExchange.Redis.RedisDatabase.ScriptEvaluateAsync(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 1547
at Microsoft.AspNetCore.OutputCaching.StackExchangeRedis.RedisOutputCacheStore.Microsoft.AspNetCore.OutputCaching.IOutputCacheBufferStore.SetAsync(String key, ReadOnlySequence`1 value, ReadOnlyMemory`1 tags, TimeSpan validFor, CancellationToken cancellationToken)
at Microsoft.AspNetCore.OutputCaching.OutputCacheEntryFormatter.StoreAsync(String key, OutputCacheEntry value, HashSet`1 tags, TimeSpan duration, IOutputCacheStore store, ILogger logger, CancellationToken cancellationToken)
### .NET Version
8
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.