dotnet / dotnet/dotnet-api-docs
Behavior of MemoryCache.GetValues did not match with dotnet API doc
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
From the dotnet [API doc](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycache.getvalues?view=netframework-4.8), the behavior of MemoryCache.GetValues should be:
> If a cache entry that is represented by the keys does not exist, the corresponding value for the returned object in the dictionary is set to null. Therefore, the returned dictionary always has the same number of items as the number of elements in keys.
However the actual behavior is that only those key value pairs stored in MemoryCache are returned.

I test the behavior with System.Runtime.Caching 4.7.0 in dotnet core, but the problem should exist for all versions.
Contributor guide
Assessment
This issue has not been assessed yet.