Skip to content

Bug in RemoveAt function#1

Open
MarkEHenderson wants to merge 18 commits intolucasmeijer:masterfrom
richard-fine:master
Open

Bug in RemoveAt function#1
MarkEHenderson wants to merge 18 commits intolucasmeijer:masterfrom
richard-fine:master

Conversation

@MarkEHenderson
Copy link

Hey, just wanted to comment that I ran into a bug with the removeAt function.

If you have a dictionary with 2 entries, and you remove the 2nd one, removeAt will not correctly remove it from the _cache. It removes it at the start of the function, but re adds it in the if(_keys.Count > 1) block.

I fixed the problem by adding "&& index != _keys.Count-1" to the if statement

( I should mention that after this happened, TryGetValue would return an error when trying to get the removed value, which caused me quite a few problems)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants