Client Cache - Redis - JSConfig Exception, MissingMethodException

Hello, i’m on 5.0.3.

I have been unable to use the Redis Cache for the auth session, from the documentation, it looks plausible to be able to do this but I have been getting this error.

And since it is beeing handled by a try catch, it doesn’t allow me to try and identify the error, even when loading the symbols in the debugger.

Here is part of the stacktrace

at ServiceStack.Redis.RedisClient.Exec[T](Func`2 action)\n   at ServiceStack.Redis.RedisClientManagerCacheClient.Get[T](String key)\n   at ServiceStack.ServiceExtensions.GetSession(IRequest httpReq, Boolean reload)\n   at ServiceStack.Auth.AuthenticateService.Post(Authenticate request)\n   at ServiceStack.Host.ServiceRunner`1.<ExecuteAsync>d__13.MoveNext(

Here is the code in the configure section

Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(AppSettings), new JwtAuthProvider(AppSettings) { AuthKey = AesUtils.CreateKey(), RequireSecureConnection = false } }));
        
        var userAuthRepo = new RedisAuthRepository(container.Resolve<IRedisClientsManager>());
        userAuthRepo.InitSchema();

        container.Register<IUserAuthRepository>(userAuthRepo);
        
        container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());
        //container.Register<ICacheClient>(new MemoryCacheClient());
        container.Resolve<ICacheClient>().InitSchema();

If I replace the CacheClient with MemoryCacheClient, everything works. Is there a reason why it would not work? What am I doing wrong in the configuration?

Thanks,

MissingMethodExceptions are indicative of dirty upgrades of using different versioned packages together. So you’d need to make sure all packages are using the same version, if they are, close your solution and delete your NuGet cache:

$ nuget locals all -clear

Then reopen and restore all packages.

Thanks !

this command fixed everything. I was using the latest packages in theory, must have had some lingering artefacts.

dotnet nuget locals all --clear
1 Like