dotnet / dotnet/dotnet-api-docs

Behavior of MemoryCache.GetValues did not match with dotnet API doc

Open
#4,150 1 comment 0 reactions 0 assignees View on GitHub
area-System.Memory Pri3 untriaged
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.

![image](https://user-images.githubusercontent.com/61817681/79989991-169c3500-84e3-11ea-8bde-2869ed88c322.png)

I test the behavior with System.Runtime.Caching 4.7.0 in dotnet core, but the problem should exist for all versions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.