CacheTower icon indicating copy to clipboard operation
CacheTower copied to clipboard

FileCacheProvider - exception about invalid Manifest

Open BAKAOLC opened this issue 9 months ago • 1 comments

What does the bug do?

I know there was a time when we had the same problem (https://github.com/TurnerSoftware/CacheTower/issues/264), but I still have this problem.

If there is no cache at the time of saving the manifest, attempting to add and access the cache will result in an exception:

System.NullReferenceException: Object reference not set to an instance of an object.
    at CacheTower.Providers.FileSystem.FileCacheLayer.GetAsync[T](String cacheKey) in /home/runner/work/CacheTower/CacheTower/src/CacheTower/Providers/FileSystem/FileCacheLayer.cs:line 211
    at CacheTower.CacheStack.GetAsync[T](String cacheKey) in /home/runner/work/CacheTower/CacheTower/src/CacheTower/CacheStack.cs:line 215

How can it be reproduced?

builder.AddFileCacheLayer(new("cache", new NewtonsoftJsonCacheSerializer(new()),
    TimeSpan.FromMilliseconds(300000)));

This doesn't even need to go through a reboot for this to occur after a certain amount of time.

Environment:

  • Operating System: All (Windows, Mac and Linux)
  • .NET Version: 9.0.101
  • Nuget Package:
    • CacheTower 0.14.0
    • CacheTower.Providers.FileSystem.Json 0.14.0
    • CacheTower.Serializers.NewtonsoftJson 0.14.0

BAKAOLC avatar Jan 06 '25 12:01 BAKAOLC