Replies: 1 comment 2 replies
-
This is by design, as the cache supports caching null values. You could write code like: IMemoryCache cache = ...;
cache.Set(key, (string?)null);
string s = cache.GetOrCreate<string>(key, e => "oops"); and that GetOrCreate call would return null, hence to be correct the API needs to be |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context: #77266
We just migrated to .NET 7.0 and got bitten by this weird behavior, which forces us to always use the dammit operator.
.NET 6.0
.NET 7.0
4 votes ·
Beta Was this translation helpful? Give feedback.
All reactions