Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
steveharter committed Sep 10, 2019
1 parent a3c8a26 commit 4a22ac4
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,17 @@ public JsonPropertyInfo GetProperty(ReadOnlySpan<byte> propertyName, ref ReadSta
// No cached item was found. Try the main list which has all of the properties.

string stringPropertyName = JsonHelpers.Utf8GetString(propertyName);
PropertyCache.TryGetValue(stringPropertyName, out JsonPropertyInfo info);
if (!PropertyCache.TryGetValue(stringPropertyName, out JsonPropertyInfo info))
{
info = JsonPropertyInfo.s_missingProperty;
}

// Three code paths to get here:
// 1) info == null. Property not found.
// 1) info == s_missingProperty. Property not found.
// 2) key == info.PropertyNameKey. Exact match found.
// 3) key != info.PropertyNameKey. Match found due to case insensitivity.
Debug.Assert(info == null || key == info.PropertyNameKey || Options.PropertyNameCaseInsensitive);

if (info == null)
{
info = JsonPropertyInfo.s_missingProperty;
}

// Check if we should add this to the cache.
// Only cache up to a threshold length and then just use the dictionary when an item is not found in the cache.
int cacheCount;
Expand Down

0 comments on commit 4a22ac4

Please sign in to comment.