AspNetCore 3.0 Exception: "Cache entry must specify a value for Size when SizeLimit is set."
See original GitHub issueIs AspNetCore 3.0 supported? I’m getting this exception on page load. Is this a bug or config error? It worked previously.
Packages:
MiniProfiler.AspNetCore.Mvc ------- 4.1.0 MiniProfiler.EntityFrameworkCore – 4.1.0
Services Call:
services.AddMiniProfiler().AddEntityFramework();
Configure Call:
app.UseMiniProfiler();
StackTrace:
System.InvalidOperationException: Cache entry must specify a value for Size when SizeLimit is set. Module “Microsoft.Extensions.Caching.Memory.MemoryCache”, in SetEntry Module “Microsoft.Extensions.Caching.Memory.CacheEntry”, in Dispose Module “Microsoft.Extensions.Caching.Memory.CacheExtensions”, in Set File “C:\projects\dotnet\src\MiniProfiler.AspNetCore\Storage\MemoryCacheStorage.cs”, line 160, col 13, in Save File “C:\projects\dotnet\src\MiniProfiler.AspNetCore\Storage\MemoryCacheStorage.cs”, line 195, col 13, in SaveAsync File “C:\projects\dotnet\src\MiniProfiler.Shared\ProfileProviders\DefaultProfilerProvider.cs”, line 112, col 13, in SaveAsync Module “System.Runtime.ExceptionServices.ExceptionDispatchInfo”, in Throw Module “System.Runtime.CompilerServices.TaskAwaiter”, in ThrowForNonSuccess Module “System.Runtime.CompilerServices.TaskAwaiter”, in HandleNonSuccessAndDebuggerNotification Module “System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter”, in GetResult File “C:\projects\dotnet\src\MiniProfiler.Shared\ProfileProviders\DefaultProfilerProvider.cs”, line 78, col 13, in StoppedAsync Module “System.Runtime.ExceptionServices.ExceptionDispatchInfo”, in Throw Module “System.Runtime.CompilerServices.TaskAwaiter”, in ThrowForNonSuccess Module “System.Runtime.CompilerServices.TaskAwaiter”, in HandleNonSuccessAndDebuggerNotification Module “System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter”, in GetResult File “C:\projects\dotnet\src\MiniProfiler.Shared\MiniProfiler.cs”, line 243, col 13, in StopAsync Module “System.Runtime.ExceptionServices.ExceptionDispatchInfo”, in Throw Module “System.Runtime.CompilerServices.TaskAwaiter”, in ThrowForNonSuccess Module “System.Runtime.CompilerServices.TaskAwaiter”, in HandleNonSuccessAndDebuggerNotification Module “System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter”, in GetResult File “C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs”, line 112, col 17, in Invoke Module “System.Runtime.ExceptionServices.ExceptionDispatchInfo”, in Throw Module “System.Runtime.CompilerServices.TaskAwaiter”, in ThrowForNonSuccess Module “System.Runtime.CompilerServices.TaskAwaiter”, in HandleNonSuccessAndDebuggerNotification Module “System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter”, in GetResult
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (3 by maintainers)
@NickCraver
Looks like EF Core is setting up the
SizeLimit
on line 258: https://github.com/aspnet/EntityFrameworkCore/blob/release/3.0/src/EFCore/Infrastructure/EntityFrameworkServicesBuilder.csTryAdd<IMemoryCache>(p => new MemoryCache(new MemoryCacheOptions { SizeLimit = 10240 }));
Work-Around: I was able to get it working by setting up the
IMemoryCache
manually before the EF Core registration:Permanent Solution: Do you have any suggestions on getting MiniProfiler to play nice with a
MemoryCache
that has theMemoryCache.SizeLimit
set?@ajcvickers done, https://www.npgsql.org/efcore/api/Microsoft.Extensions.DependencyInjection.NpgsqlServiceCollectionExtensions.html.