Skip to content

UWP InvalidateCacheEntryAsync leaves MemoryCache in inconsistent state #1543

Open
@craigwi

Description

@craigwi

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions