Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

UWP InvalidateCacheEntryAsync leaves MemoryCache in inconsistent state #1543

Open
6 tasks
craigwi opened this issue Aug 27, 2021 · 0 comments 路 May be fixed by #1553
Open
6 tasks

UWP InvalidateCacheEntryAsync leaves MemoryCache in inconsistent state #1543

craigwi opened this issue Aug 27, 2021 · 0 comments 路 May be fixed by #1553

Comments

@craigwi
Copy link

craigwi commented Aug 27, 2021

馃悰 Bug Report

Calling FFImageLoading.ImageService.Instance.InvalidateCacheEntryAsync(url, FFImageLoading.Cache.CacheType.All) and then later trying to show the same url results in an exception "The LinkedList node does not belong to current LinkedList."

Expected behavior

No exception.

It appears that the issue is in the implementation of Remove in LRUCache.cs:

    public void Remove(TKey key)
    {
        LinkedListNode<LRUCacheItem<TKey, TValue>> node;
        if (_cacheMap.TryGetValue(key, out node))
        {
            _lruList.Remove(node);
        }
    }

The call '_lruList.Remove(node)' should probably 'this.RemoveNode(node)'. The code as it stands removes the item from the lru list, but not the dictionary.

Version: 2.4.11.982

Platform:

  • 馃摫 iOS
  • 馃 Android
  • 馃弫 WPF
  • [X ] 馃寧 UWP
  • 馃崕 MacOS
  • 馃摵 tvOS
  • 馃悞 Xamarin.Forms
craigwi added a commit to craigwi/FFImageLoading that referenced this issue Dec 19, 2021
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 a pull request may close this issue.

1 participant